How to remove a file included in parent theme with locate_template() via child theme?

An alternative solution that takes inspiration from both answers by @Milo and @toscho. create your own function to load template, e.g. if ( ! function_exists(‘my_locate_template’) ) { function my_locate_template( $template=””, $load = false, $once = true ) { $filtered = apply_filters(‘allow_child_load_’ . $template, true); if ( ! is_child_theme() || $filtered ) return locate_template($template, $load, $once); … Read more

how to edit functions.php in a child theme

Nearly all functions in esplanade can be overwritten in a child theme. Take the esplanade_admin_header_style() function for instance. Just before that function is the following line of code if ( ! function_exists( ‘esplanade_admin_header_style’ ) ) : . The important part here is if ( ! function_exists()): This means that the function it calls can be … Read more

Deregister and Dequeue Stylesheets From a Plugin and Enqueue a Child’s Stylesheet/s

As kaiser noted, you probably need a higher priority. add_action( ‘wp_enqueue_scripts’, ‘load_alta_styles’, 20 ); But if not, you can use wp_style_is to check and see after you do things if they are as expected. e.g. you might try: if ( wp_style_is( ‘wp_listings_single’, ‘enqueued’ ) ) { wp_dequeue_style( ‘wp_listings_single’ ); echo ‘<p>Seems to have been dequeued</p>’; … Read more

Activate Child Theme with Codex

Use switch_theme as already indicated in another answer, but hook it to wpmu_new_blog This function runs when a user self-registers a new site as well as when a super admin creates a new site. hook to ‘wpmu_new_blog’ for events that should affect all new sites. https://codex.wordpress.org/function_reference/wpmu_create_blog If not the code will run constantly, which will … Read more

Passing variable from child theme to parent theme

Stick to filtering one value at a time to keep it simple, and add filters for the colors to be used by the child theme: add_filter( ‘post_thumbnail_html’, ‘map_thumbnail’); function map_thumbnail($html) { $my_post = get_post($post->ID); $defaultcolor1 = “#??????”; // parent theme default $defaultcolor2 = “#??????”; // parent theme default $water_color = apply_filters(‘water_color’,$defaultcolor1); $tree_color = apply_filters(‘tree_color’,$defaultcolor2); if($my_post->post_name … Read more

How to add a tag to wp_nav_menu in a child theme

The wp_nav_menu() function has a ton ( or bunch ) of parameters which makes customization fairly easy. I believe the one you’re specifically looking for is after which will add a passed string into the list after the link. An example would look like this: wp_nav_menu( array( ‘menu’ => ‘Main Menu’, ‘container’ => ‘nav’, ‘theme_location’=> … Read more

Child theme style repeated

I think you can try this : <?php add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); } ?> Just try it. i hope is useful.

Enqueue Child CSS to Load After Bootstrap CDN

Adding the dependency should work. You are not calling your theme styles file correctly though. You need to move your theme-style.css file down to the root folder of the theme itself and name it style.css. So your function should look as follows: function my_enqueues() { wp_enqueue_style( ‘bootstrap-css’, ‘//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css’ ); wp_enqueue_style( ‘theme-css’, get_stylesheet_uri(), array( ‘bootstrap-css’ ) … Read more