Redeclare a function in a child theme

Redeclaring a function in a child theme only works when the parent themes’ function is wrapped in a if( !function_exists( ‘function_name’ )): condition. Then you can simply just copy the complete function to the child theme and do whatever modifications you need to do. If the parent themes’ functions aren’t wrapped in that if conditional … Read more

My child theme doesn’t work Error: “The parent theme is missing. Please install your parent theme”

There are three things to check: Is your parent theme complete and what is the exact spelling of the parent theme’s name in its style.css. Uppercase and lowercase are important. Is the child theme directory named parentname-child. It should be in the themes directory, not in a subdirectory of the parent theme. Does the child … Read more

How to override function in child theme

I am not sure if the function in the functions_custom.php that you wants to override is a pluggable functions like below: if ( ! function_exists ( ‘function_name’ ) ) { function function_name() { // Function Code } } If it is pluggable function then you can simply write function with same name in your child … Read more

@package & @subpackage: how to use with child themes

Rule of thumb: is your code bundled (i.e. packaged) with whatever code indicated by @package? If no, then you are using an incorrect value for @package. For the case of most Themes, this is easy: Core-bundled Themes use @package: WordPress and @subpackage Theme-Name, because they are packaged and distributed with WordPress itself All other Themes … Read more

How do I cleanly override a plugin’s CSS with a child theme?

If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them: function wpa_dequeue_style() { wp_dequeue_style( ‘plugin-style-handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_dequeue_style’, 100 ); Whether or not this works depends on how and where the plugins are adding their styles, so there’s no absolute answer without knowing specific methods the plugins … Read more

Include files in child theme functions file

Child themes reference parent themes by directory name, and in a normal install all your themes live in wp-content/themes/, so I’d say it’s fine to reference those themes by their relative path: include ‘../parent-theme/some-file.php’; If that makes you uncomfortable, I observe the following constants in WordPress 3.0.1 with a twentyten child theme called tt-child: TEMPLATEPATH … Read more

Issues enqueueing parent & child theme stylesheets with revised Codex method

QUESTION 1 Is it safe to include the assumption that parent themes properly enqueue the child theme styles, from the standpoint of child theme standards? General rule of thumb, yes. But, you should never assume. Most disasters and failures in live are due to assumptions or facts based on an assumption FACTS WITHOUT ASSUMPTIONS A … Read more

Cannot get Child Theme to load latest version of style.css

In twentyfourteen, try putting this in your child theme: function add_require_scripts_files() { wp_enqueue_style(‘twentyfourteen-style’, get_stylesheet_directory_uri().’/style.css’, array(), ‘1.0.0’, “all”); } add_action( ‘wp_enqueue_scripts’, ‘add_require_scripts_files’ ); This will replace the original stylesheet but with your own version. If you are using a different parent theme, look at the original wp_enqueue_style label for style.css and duplicate that label within your … Read more

How to modify single.php in a child theme?

your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. with the exception: Unlike style.css, the functions.php of a child theme does not override its … Read more