New answers tagged

1

Make sure that you're not just calling these functions within functions.php, but calling them at the right time with add_action(). Try the following: // in your Child Theme's functions.php // Use the after_setup_theme hook with a priority of 11 to load after the // parent theme, which will fire on the default priority of 10 add_action( '...


1

It's import to set the priority for your after_setup_theme higher than your parent theme. The default priority is 10. Using the twentysixteen as example, use priority 11 on child themes' 'after_setup_theme' action. Exemple below: function twentysixteen_child_setup() { add_theme_support( 'post-formats', array( 'video', ) ); } add_action( '...


2

Wordpress provide a filter to custom logo customization. get_custom_logo is the filter. To change logo class, this code may help you. add_filter('get_custom_logo','change_logo_class'); function change_logo_class($html) { $html = str_replace('class="custom-logo"', 'your-custom-class', $html); $html = str_replace('class="custom-logo-link"', 'your-...


9

Here's one suggestion how we might try to add classes through the wp_get_attachment_image_attributes filter (untested): add_filter( 'wp_get_attachment_image_attributes', function( $attr ) { if( isset( $attr['class'] ) && 'custom-logo' === $attr['class'] ) $attr['class'] = 'custom-logo foo-bar foo bar'; return $attr; } ); where ...


5

As you found yourself the_custom_logo relies on get_custom_logo, which itself calls wp_get_attachment_image to add the custom-logo class. The latter function has a filter, wp_get_attachment_image_attributes which you can use to manipulate the image attributes. So what you could do is build a filter that checks if the custom-logo class is there and if yes ...


1

I think I found one answer. But I really wonder if this is the right way? It feels a little bit dirty somehow: I simply copied the logo related parts from wp-includes/general-template.php into my theme's functions.php and renamed the functions with some custom classes added: function FOOBAR_get_custom_logo( $blog_id = 0 ) { $html = ''; if ( ...



Top 50 recent answers are included