Get parent theme version

In the WP_Theme class, the get method gives you a sanitized theme header. You cannot use it to extract a property. Actually you don’t need to, as you can access it directly like this: // get the parent object $parent = wp_get_theme()->parent(); // get parent version if (!empty($parent)) $parent_version = $parent->Version;

Removing custom background and header feature in child theme

Both the header and background image features setup some globals in order to work, unsetting those globals seems to have some effect, and at the least removes them from the administration side. add_action(‘after_setup_theme’, ‘remove_theme_features’, 11 ); function remove_theme_features() { $GLOBALS[‘custom_background’] = ‘kill_theme_features’; $GLOBALS[‘custom_image_header’] = ‘kill_theme_features’; } class kill_theme_features { function init() { return false; } … Read more

Is it possible to disable a function of a parent theme?

Only under some circumstances. If the parent theme’s functions are wrapped in function_exists conditionals then you should be able to replace them. For example: // Parent if (!function_exists(‘p_wpse_95799’)) { function p_wpse_95799() { // } } If the child theme defines a function named p_wpse_95799 then the parent function will not be used. If this is … Read more

Get Parent Theme Author Name

Thanks for all the help which pointed me in the right direction. In the end I used the following: $style_parent_theme = wp_get_theme(get_template()); $style_parent_theme_author = $style_parent_theme->get( ‘Author’ ); I use get_template() to recover the folder name of the parent theme. wp_get_theme then get’s the theme object. Once we have that we can manipulate the object to … Read more

how to call files in child theme?

One does not simply throw <link> (CSS) or <script> tags into the <head> of a WordPress theme. The right way to do it: Register, enqueue … tadaa! WordPress has the “Dependency API” for this task. It consists basically out of those public functions: wp_register_script() wp_enqueue_script() wp_register_style() wp_enqueue_style() Then there’re aligning functions to deregister scripts or … Read more

Give priority to child theme stylesheet

Your child theme’s stylesheet will usually be loaded automatically. If it is not, you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it. /** * Enqueue theme styles (parent first, child second) * */ function wpse218610_theme_styles() { $parent_style=”parent-style”; wp_enqueue_style( $parent_style, get_template_directory_uri() . … Read more