Changing wordpress default language

If/When you want to have wordpress in your own language you could/should download the swedish version imho. Go and look here for the translated package. Because thats the best way to do. Only having some language files doesn’t do always the trick. Download the package from the link I mentioned, unzip/untar unrar or whatever you … Read more

How to add PHP pagination to wordpress

you can use paginate_links() from wordpress core API, its make more easily to paginate your custom query. And you dont need to make another query to get all users count. <?php $users_per_page = 10; // total no of author to display $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; if( (int)$paged === 1 ){ $offset = … Read more

How to make sure relative URL works when site is not on root domain?

Make use of the functions wordpress offers to determine paths and URLs – see Determining Plugin and Content Directories. For example use: get_template_directory to Retrieves the absolute path to the directory of the current theme, without the trailing slash. or get_stylesheet_directory to Retrieve stylesheet directory Path for the current theme/child theme. You find more information … Read more

Need advice on theme customizer and child themes

I would comment if able. If your theme variations consist solely of style modifications you can add the variation stylesheets @ inc/css/ and then here is an example of the references to make it all tick. @ \options\options-core.php: $fields_list[] = array( ‘name’ => __(‘Select a Skin Color’, ‘mytheme’), ‘id’ => ‘mytheme_skin_color’, ‘std’ => ‘default’, ‘type’ … Read more

How can I assign separate stylesheets to different pages?

The correct method is to enqueue the stylesheets, via callback hooked into wp_enqueue_scripts. You can add the contextual conditionals inside the callback: function wpse124258_enqueue_scripts() { if ( ! is_admin() ) { // Conditionally enqueue if ( is_front_page() ) { // Front page stylesheet wp_enqueue_style( ‘front-page-style’, get_template_directory_uri() . ‘/front-page-stylesheet.css’ ); } else if ( is_page() ) … Read more

How do I include an external PHP file in a subdir WordPress install?

In you case I’d edited my wp-config.php, and just after if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . “https://wordpress.stackexchange.com/”); I’d added $path = explode( basename( dirname(__FILE__) ), ABSPATH ); define( ‘MYSITEROOTPATH’, $path[0] ); after that, everywhere I need, I’d used // file.php is name of a file in root directory include( MYSITEROOTPATH . ‘file.php’);

Usage of var keyword in the core

Normally WordPress backward compatibility is very strong, (sometimes too much strong IMHO). So it’s close to impossible that a public property (properties declared with var are public at any effects) become private in a future release. However, as you noticed, the variable is marked as private in class doc block, this mean that developers should … Read more