Git vs Child Theme

While I know version control approach to be used in practice, I don’t think it’s too common. WP has weak version control practices in general, so development of extensions doesn’t quite plan for such. Example of specific scenario which will cause issues might be changes in template hierarchy. Let’s say you customized single.php in version … Read more

get_parent_theme_file_path vs. get_template_directory

Is there a specific reason to use get_parent_theme_file_path() over get_template_directory() Yes. This new function comes with a filter Filter parent_theme_file_path And argument to the file path If you take a look at the get_parent_theme_file_path() source, it’s just returning get_template_directory() with extra functionality like if a file is given as an argument to the get_parent_theme_file_path it … Read more

Hiding Parent Theme

There is a filter called wp_prepare_themes_for_js in wp-admin/includes/theme.php in the wp_prepare_themes_for_js() function, which is called by wp-admin/themes.php to populate the theme set. That filter will allow you to remove themes from the list. Of course, you have to know the theme name. function kill_theme_wpse_188906($themes) { unset($themes[‘twentyten’]); return $themes; } add_filter(‘wp_prepare_themes_for_js’,’kill_theme_wpse_188906′);

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

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