Theme Customizer not loading

if customizer(live preview) doesnt work or doesnt load and nothing is shown, try these steps: do you have redirections on the problematic site (double check and ensure, there might be coded a custom redirection in your plugins/codes)? while the circle is still loading, change any option in customizer and click “SAVE & PUBLISH” and see, … Read more

Extra themes – ok or bad?

Any extra code on your server is a theoretical security risk. Instead of checking each plugin and theme if they are security risk even if they are not active, it is much easier to just delete them. This of course should not prevent you from backuping them first in case you will decide that you … Read more

WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]

Something went wrong with your installation. As commented by @Sumit get_header() is a core function and cannot be undefined. To troubleshoot: Reinstall WordPress and enable WP_DEBUG in wp_config.php: define( ‘WP_DEBUG’, true ); If it is on a live site you might want to use this instead: define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); This … Read more

Activate a new WordPress Theme Only for Admins

At first, you should active the WordPress Debug mode to get the error after implement your code. The code should work, also tested on my environment. I use it on a client installation and works really well. See my source below. It is important that you use the right string for the theme slug, like … Read more

How to set page template on front using starter content?

The reference to a post needs the item symbol within double curly braces: add_action(‘after_setup_theme’, function () { add_theme_support( ‘starter-content’, array( ‘posts’ => array( ‘home’ => array( // Use a page template with the predefined about page ‘template’ => ‘template-frontpage.php’, ), ), ‘options’ => array( ‘show_on_front’ => ‘page’, ‘page_on_front’ => ‘{{home}}’, ), )); }); And remember: … Read more

How get Themes list via REST api?

You can write your own endpoint and use wp_get_themes to get a list of themes via that. Here is a simple one: add_action( ‘rest_api_init’, function () { //Path to rest endpoint register_rest_route( ‘theme_API/v1’, ‘/get_theme_list/’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘theme_list_function’ ) ); }); // Our function to get the themes function theme_list_function(){ // Get … Read more