[Resolved] Custom logo on different pages

Home Forums Support [Resolved] Custom logo on different pages

Home Forums Support Custom logo on different pages

  • This topic has 3 replies, 3 voices, and was last updated 1 month ago by Fernando.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2280667
    Michael

    Hi

    I did the following successfully in the past, maybe I am doing something wrong this time.
    Goal is to have a different logo for specific pages.

    // Decide when to display the positive or negative logo
    add_filter( 'generate_logo','mh_custom_about_logo' );
    function mh_custom_about_logo( $logo )
    {
     	// If we are on the feed page, set our custom logo
     	if ( is_page( 'feed-2' ) )
     	 	return '/wp-content/uploads/2022/07/custom-logo.png';
     	// Or else, set the regular logo
     	return $logo;
    }

    But it does not work for some reason – do you see the issue?
    Thanks a lot,
    Michael

    #2280739
    Leo
    Staff
    Customer Support

    Hi Michael,

    Have you considered using the Site Logo option with in the merged header element you are using?
    https://docs.generatepress.com/article/transparent-header-and-navigation/

    That should work for most cases.

    The video in the documentation should be helpful.

    Let me know 🙂

    #2281133
    Michael

    Hi Leo

    Thanks a lot, that worked.
    However, I am still wondering why the code above does not work. Seems weird to me as I cannot see an issue there.

    Cheers,
    Michael

    #2281219
    Fernando
    Customer Support

    Hi Michael,

    It should work. Are you using a retina logo? If so, you’ll need to replace the retina logo as well through generate_retina_logo filter.

    Example:

    add_filter( 'generate_retina_logo','mh_custom_about_logo' );
    function mh_custom_about_logo( $logo )
    {
     	if ( is_home() ) {
    		
    		$logo = 'https://fazarcon.pluginsupportwp.com/wp-content/uploads/2022/06/medium.jpg';
    		return $logo;
    	}
     	return $logo;
    }

    Try placing the entire image URL.

    Kindly let us know how it goes.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.