Child Theme Performance

When you set a child theme, basically WP looks into 2 directories to see if there are some overriding to make. So it adds some impact on performance. The use of @import in child CSS can also have some bad impact on performance grade. Most of the time, it depends on the parent’s theme quality. … Read more

Child theme preview missing

Unfortunately this isn’t covered in that codex page. These previews of the themes aren’t auto generated. You will need to take a screenshot of your theme, and upload that screenshot to your root folder as ‘screenshot.png’. This screenshot will be automatically used then as a theme preview pic for your theme. I quote from the … Read more

Child theme showing a blank page

I think you’ve nothing in the index.php file. So what is happening that the child theme is calling the child theme’s index.php over parent theme’s index.php. And you have nothing on index.php. So the site is showing nothing. Delete the child theme’s index.php. You’ll see the site live.

Function to activate WordPress theme inside a plugin

Of course there’s a function for that (Codex): switch_theme( $stylesheet ) It: Switches current theme to new template and stylesheet names. Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It’s the same value that you’d use for a child theme, something like twentythirteen.) It also accepts an additional function signature … Read more

How do I remove a require_once admin panel from the parent theme from the child theme functions.php?

For cases where you want to require/include PHP files, but still allow child themes to replace those PHP files outright, then you should use the locate_template function. Example: Parent does this: locate_template( ‘admin/file.php’, true ); This finds the admin/file.php file in either the child or the parent theme, then does a require on it (that’s … Read more

Is it possible to override this function/class in a child theme?

You simply need to run your code on a higher priority than what the parent theme is, the default on add_action function is 10 so you can use: function s157343_unregister_widgets() { unregister_widget( ‘Chocolat_Widget_New_Entrys’ ); } add_action( ‘widgets_init’, ‘s157343_unregister_widgets’, 20 ); This will unregister that widget. Of course, you can still create a new class that … Read more