0

I made a child theme of HTML5 blank where I want to do some modifications like showing the admin bar.

A solution that I found on SO is this: https://stackoverflow.com/questions/33739096/html5-blank-theme-wp-admin-bar

But that is not a good solution because the modification happens in the parent theme's functions.php file.

I also noticed that on line 379 of the functions.php in the parent theme if I change add_filter('show_admin_bar', 'remove_admin_bar'); into add_filter('show_admin_bar', '__return_true'); the change works fine.

Now all I want is to simply create a functions.php file inside my-child-theme/functions.php and simply paste add_filter('show_admin_bar', '__return_true'); in it but that doesn't seem to do anything. The child theme works fine and other modifications are also working fine outside the functions.php file. From what I gathered, simply adding functions.php to your child theme should make it able to have the content override the parent's file, no?

  • 2
    No it's doesn't override first child-theme's functions.php is loaded and then parent theme's – bravokeyl Sep 7 '16 at 11:43
1

Having the same problem, I found the solution here: https://pagecrafter.com/how-to-remove-filters-using-child-theme/

The thing is this: 1) do not touch the function in parent theme, 2) remove that filter in the child function.php in this way:

//Remove the filter that removes the admin bar
function remove_parent_filters(){ //Have to do it after theme setup, because child theme functions are loaded first
    remove_filter('show_admin_bar', 'remove_admin_bar');
}
add_action( 'after_setup_theme', 'remove_parent_filters' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.