Tag Info

Hot answers tagged

8

WordPress 3.9 introduces a theme_page_templates filter. The example below from a Twenty Fourteen child theme functions.php shows how to remove the "Contributor Page" template: function tfc_remove_page_templates( $templates ) { unset( $templates['page-templates/contributors.php'] ); return $templates; } add_filter( 'theme_page_templates', ...


7

You don't have to use @import. It's best not to, actually. Using an enqueued approach is probably better all around. Here's the relevant part of twentythirteen's code: function twentythirteen_scripts_styles() { ... // Loads our main stylesheet. wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' ); ... } ...


4

There's a new filter in WP core (3.9) to remove page templates. It can be used from child themes. Here's how to achieve this in TwentyTen (tested on WP 3.9): add_filter( 'theme_page_templates', 'my_remove_page_template' ); function my_remove_page_template( $pages_templates ) { unset( $pages_templates['onecolumn-page.php'] ); return ...


1

The functions.php file executes at plugins_loaded, with the Child Theme functions.php executing before the Parent Theme functions.php. That means that, in order to load functional sub-files in the Child Theme after the Parent Theme functions.php executes, you simply need to hook your include() calls after plugins_loaded. A usually safe action for such ...


1

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 ...


1

Although Otto's answer is pretty good, I ended up with this in my child theme's functions.php function my_theme_styles() { global $wp_styles; $parentOriginalHandle = 'twentythirteen-style'; $parentNewHandle = 'parent-style'; // Deregister our style.css which was enqueued by the parent theme; we want // to control the versioning ourself. ...


1

The WP_DEFAULT_THEME constant actually just overrides what WordPress sets as default theme (which per default is the latest of the bundled themes). It does not really help you to define your parent theme. In fact you just have to "Network enable" your parent and child themes and then set the parent theme in the child themes header. No need to do more than ...


1

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 child theme's ...



Only top voted, non community-wiki answers of a minimum length are eligible