• Hi, I started using this awesome theme now for my newly developed site(s) and facing a weird issue.

    Issue:

    https://snipboard.io/J5AxFW.jpg

    https://snipboard.io/s1XgrM.jpg

    As I used a transperent PNG image as logo I was trying to use cover template everywhere to keep consistency. Even in Homepage, Blog, Categories and other WP archive.php template. But I didn’t find any way to set the Cover Template for Blog, Categories, Tags and other WP archive.php pages so that the theme remain consistent. If it’s not possible, I have to use two different type of logo for different templates. One for Cover Template and other for Default template.

    So, please advise me how to solve this issue.

    Thans again for providing such an awesome theme for the community!

    Best Regards
    @rafatrock

    • This topic was modified 4 years, 4 months ago by rafatrock.
Viewing 6 replies - 1 through 6 (of 6 total)
  • @rafatrock You can use this code in your child theme’s functions.php or parent’s:

    
    add_filter( 'twentytwenty_site_logo', function( $html, $args, $classname, $contents ) {
    	if ( is_page_template( 'templates/template-cover.php' ) && has_custom_logo() ) {
    		$logo      = get_custom_logo();
    		$logo      = preg_replace( '@src="([^"]+)"@', 'src="https://via.placeholder.com/150"', $logo );
    		$contents  = sprintf( $args['logo'], $logo, esc_html( get_bloginfo( 'name' ) ) );
    		$wrap      = $args['condition'] ? 'home_wrap' : 'single_wrap';
    		
    		return sprintf( $args[ $wrap ], $classname, $contents );
    		
    	}
    	
    	return $html;
    }, 10, 4 );

    In the customizer you start by using the black on white logo and in the above code replace https://via.placeholder.com/150 with the transparent logo’s url.

    On every page that uses the cover template it will display the transparent logo.

    • This reply was modified 4 years, 4 months ago by acosmin.
    • This reply was modified 4 years, 4 months ago by acosmin.

    I made a custom plugin that has this option in the Customizer, in case you still need it:
    https://wordpress.org/plugins/extra-options-for-twenty-twenty/

    @acosmin I had the same issue, want to switch between light and dark versions of my logo to account for changes in whether the cover image was present. Your code worked great. Thanks so much!

    @meetinghero I’m glad to hear that, you can also use the plugin mentioned above if you want to change it from the Customizer.

    Hello,

    For some reason the ‘extra options for twenty twenty’ plugin, conflicts with the woocommerce plugin. So I thought I’d use your code above to change the logo image source for the cover template page. But something else happens: there’s no logo visible on the cover template. So the standard logo is gone, and nothing is replacing it.

    Do you have any idea how to fix this?

    Or: can you tell me how to erase all files of the twenty twenty plugin when removed? So I can completely start over with that plugin? Because on my testsite there is no conflict between the two. So that’s mystifying.

    Thank you so much!

    Correction:

    I was trying css as well, so that nothing showed isn’t completely down to your code. What actually happens when I just use your code:

    I see the logo that I see on every page. But when I check elements in my browser I see that the img src has actually changed (that is the right file), the srcset hasn’t.

    Sorry for the confusion!

    • This reply was modified 3 years, 11 months ago by renate1975.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to use Cover template for Categories and Blog pages’ is closed to new replies.