I'm using Wordpress - Genesis and as Childtheme Enterprise Pro. I love them both but I have one question about pagination slug.
On this page it now is
https://www.hostingportaal.nl/nieuws/page/2/
I want the slug to be:
https://www.hostingportaal.nl/nieuws/pagina/2/
Is it possible to change the slug with a hook or something? Would like to know how I can change this. Help would be very welcome.
Thanks, and keep up the good work. I really love Genesis!
Kind regards,
Joep
This isn't related to using Genesis, or any other particular theme. It's a more general WordPress issue.
https://wordpress.stackexchange.com/questions/57070/change-the-page-slug-in-pagination has a couple of solutions, the first of which is copied and amended here:
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Page to Pagina
* Description: Change <code>/page/</code> to <code>/pagina/</code>.
* Author: Thomas Scholz <info#toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
if ( ! function_exists( 't5_page_to_pagina' ) ) {
register_activation_hook( __FILE__ , 't5_flush_rewrite_on_init' );
register_deactivation_hook( __FILE__ , 't5_flush_rewrite_on_init' );
add_action( 'init', 't5_page_to_pagina' );
function t5_page_to_pagina() {
$GLOBALS['wp_rewrite']->pagination_base = 'pagina';
}
function t5_flush_rewrite_on_init() {
add_action( 'init', 'flush_rewrite_rules', 11 );
}
}
Related
I have just created a new child theme and here is my source code which I followed the official WordPress Child Themes document.
style.css
/*
Theme Name: Astra Child Theme
Theme URI: http://example.com/twenty-fifteen-child/
Description: Astra Child Theme
Author: xxx
Author URI: https://...
Template: astra
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: astra
*/
funtions.php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_uri(),
array( 'parenthandle' ),
wp_get_theme()->get('Version') // this only works if you have Version in the style header
);
}
I have tried different declarations for functions.php I can't find a reason why customise page, Elementor page, etc. they can be loaded correctly as customise page will be just auto-reloading which can be observed from the network and Elementor will just be loading like this.
Therefore, I am here asking for help and thank you so much in advance.
Astra actually has its own child theme for use. Though most of the issues you are experience are related to JS. Make sure WordPress and Plugins are updated. With all the changes and with WordPress pushing for updated jQuery if you are using outdated plugins it could cause issues.
<?php
/**
* Astra Child Theme functions and definitions
*
* #link https://developer.wordpress.org/themes/basics/theme-functions/
*
* #package Astra Child
* #since 1.0.0
*/
/**
* Define Constants
*/
define( 'CHILD_THEME_ASTRA_CHILD_VERSION', '1.0.0' );
/**
* Enqueue styles
*/
function child_enqueue_styles() {
wp_enqueue_style( 'astra-child-theme-css', get_stylesheet_directory_uri() . '/style.css', array('astra-theme-css'), CHILD_THEME_ASTRA_CHILD_VERSION, 'all' );
}
add_action( 'wp_enqueue_scripts', 'child_enqueue_styles', 15 );
I'm trying to execute [year] shortcode in Site Title to show dynamic year. Created the shortcode using this:
add_shortcode( 'year' , 'current_year' );
function current_year() {
$year = date("Y");
return "$year";
}
Then to execute shortocde, I tried:
add_filter( 'the_title', 'do_shortcode' );
add_filter( 'wp_title', 'do_shortcode' );
But none of them works.
Site Title shows up in the WordPress dashboard (in the top left corner beside WordPress icon), RSS title, in place of the logo (if none is used), and og:site_name in page source.
I'm using the RankMath plugin for SEO if that helps in any way.
<?php
/**
* Plugin Name: Title
* Plugin URI: http://www.deploya.ir
* Description: Do you want a shortcode for Page title?
* Version: 1.0
* Author: Codekit
* Author URI: http://codekit.ir
*/
/* title to get the post title */
/* title to get the post title */
function myshortcode_title( ){
return get_the_title();
}
add_shortcode( 'page_title', 'myshortcode_title' );
I made a plugin with this code to prevent changing function.php from updating each time
I use the Options Tree. Just to use a Meta Box only. And I do not use his Theme Options.
In the picture below, how to throw Theme Options menu?
Is it possible?
Add the following code to your functions.php file:
function remove_ot_menu () {
remove_submenu_page( 'themes.php', 'ot-theme-options' );
}
add_action( 'admin_init', 'remove_ot_menu' );
This will remove the panel you want to remove.
/**
* Option Tree Files
* Including Files and setting up Option Tree
*
* #Since 1.0.0
* Version 1.0.0
*/
if(class_exists('OT_Loader' )):
//Filter for option tree settings
add_filter( 'ot_show_pages', '__return_false' );
add_filter( 'ot_show_new_layout', '__return_false' );
add_filter( 'ot_post_formats', '__return_true');
add_filter( 'ot_use_theme_options', '__return_false' ); //This filter removes theme options page.
endif;
The code above is helpful to remove custom Theme options page from Option Tree, make sure you add this in functions.php
This code is helpful for people who want to just use Metaboxes of OptionTree plugin not the Theme options.
The wordpress plugin has the following format
<?php
/*
* Plugin Name: XYZ
* Plugin URI: #
* Description: It is used to ..
* Version: 1.1
* License: GPLv2 (or later)
*/
But the text for license does not appear in the admin side's installed list.
for e.g for Akismet - this is the format
Version 2.5.9 | By Automattic | Visit plugin site
The text entered for license does not show up. How can I display the text for license using the wordpress format.
Thanks in Advance
Wordpress ist not showing the license text anywhere.
See: plugin.php
You can use plugin_row_meta filter to add extra row in your plugin listing. See code below for detail:
function set_plugin_meta($links, $file) {
$plugin = plugin_basename(__FILE__);
// create link
if ($file == $plugin) {
return array_merge(
$links,
array( sprintf( 'Your License type', $plugin, __('myplugin') ) )
);
}
return $links;
}
add_filter( 'plugin_row_meta', 'set_plugin_meta', 10, 2 );
I've found a great plugin for WordPress under GPLv2 license and made a lot of changes in source code, plugin does something else now.
I modified author (with original plugin author's credits), URL, version number (from xxx 1.5 to YYY 1.0).
Everything works great, but when WordPress checks for plugin updates it treats my plugin YYY 1.0 as xxx 1.0 and displays notification about available update.
My changed plugin YYY 1.0 was installed by copying files from my computer, not from WP repository.
What else do I have to change?
Disable plugin update
Add this code in your plugin root file.
add_filter('site_transient_update_plugins', 'remove_update_notification');
function remove_update_notification($value) {
unset($value->response[ plugin_basename(__FILE__) ]);
return $value;
}
Put this code in the theme functions.php file. This is working for me and I'm using it. Also this is for specific plugin. Here you need to change plugin main file url to match to that of your plugin.
function my_filter_plugin_updates( $value ) {
if( isset( $value->response['facebook-comments-plugin/facebook-comments.php'] ) ) {
unset( $value->response['facebook-comments-plugin/facebook-comments.php'] );
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'my_filter_plugin_updates' );
Here:
"facebook-comments-plugin" => facebook comments plugin folder name
"facebook-comments.php" => plugin main file.this may be different like index.php
Hope this would be help.
The simplest and effective way is to change the version of the plugin which you don't want to get update.
For an example
if I don't want wptouch to get updated, I open it's defination file, which is like:
/*
Plugin Name: WPtouch Mobile Plugin
Plugin URI: http://www.wptouch.com/
Version: 4.0.4
*/
Here in the Version change 4.0.4 to 9999
like:
/*
Plugin Name: WPtouch Mobile Plugin
Plugin URI: http://www.wptouch.com/
Version: 9999
*/
In the plugin file, there will be a function that will check for updates. The original author could have named this anything, so you will have to go through the code and check each function and what it does. I would imagine the function will be quite obvious as to what it does.
Alternatively you can add this to your plugin file:
add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 );
function dm_prevent_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$my_plugin] );
unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
return $r;
}
Credits: http://developersmind.com/2010/06/12/preventing-wordpress-from-checking-for-updates-for-a-plugin/
add_filter('site_transient_update_plugins', '__return_false');
in function.php add above code and disable all plugins updates
Add this line to wp-config.php to disable plugin updates:
define('DISALLOW_FILE_MODS',true);
One easy solution was to change the version of plugin in plugin file.
For example if plugin version is 1.2.1. You can make it like below (100.9.5 something that plugin author will never reach to )
<?php
/*
* Plugin Name: Your Plugin Name
* Description: Plugin description.
* Version: 100.9.5
*/
Here's an updated version of Mark Jaquith's script:
WP Updates have switched to HTTPS
Unserialize was blocked on my shared hosting
This uses json_decode and json_encode instead
Credit: Block Plugin Update
.
add_filter( 'http_request_args', 'widget_disable_update', 10, 2 );
function widget_disable_update( $r, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = json_decode( $r['body']['plugins'], true );
unset( $plugins['plugins'][$my_plugin] );
unset( $plugins['active'][array_search( $my_plugin, $plugins['active'] )] );
$r['body']['plugins'] = json_encode( $plugins );
}
return $r;
}
Disable plugin updates manually:
Open functions.php file (go to your activated themes folder)
Copy and paste the following code:
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
Save changes, and you’re done
Just for completeness, here is one more plugin meant to block updates of selected other plugins:
https://github.com/daggerhart/lock-plugins
Some information about its background and mode of function can be found here (in German).