[Resolved] Change Nav Logo For Different Category Pages

Home Forums Support [Resolved] Change Nav Logo For Different Category Pages

Home Forums Support Change Nav Logo For Different Category Pages

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #389100
    Bobby

    Hello Tom,

    I have another question. Is it possible to have a different header logo and sticky nav logo for a specific category page?

    I have two domain names and I want to redirect one of the domains to a specific category page on my site, but I also want the header logo and sticky nav logo to reflect the second domain’s name…in other words, I want the logos on this specific category page to be different from the logos on the rest of the site.

    Thanks.

    #389123
    Leo
    Staff
    Customer Support

    Hi there,

    This should help: https://docs.generatepress.com/article/generate_logo/#example

    Let me know.

    #389133
    Bobby

    Hi Leo,

    I’m a newbie to filters. I know where to put the filter, but can you tell me what/where to add to this filer code to get it to work?? I see where I need to put the category logo url, but where do i specify the category??

    add_filter( ‘generate_logo’,’tu_category_logo’ );
    function tu_category_logo( $logo ) {

    // Return our category logo URL
    if ( is_category() ) {
    return ‘URL TO YOUR CATEGORY LOGO’;
    }

    // Otherwise, return our default logo
    return $logo;
    }

    #389153
    Leo
    Staff
    Customer Support
    #391919
    Bobby

    Hello Leo,

    I followed the thread all the way through from the link you gave me, but its still not working.

    Im using the code Tom provided below…..I placed inside my Simple PHP plugin

    add_filter( ‘generate_logo’, ‘generate_category_logo’ );
    function generate_category_logo()
    {
    if ( is_category( ‘My Category’ ) || in_category( ‘My Category’ ) ) {
    return ‘URL TO CATEGORY LOGO’;
    }

    return ‘URL TO SITE-WIDE LOGO’;
    }

    For example:

    add_filter( ‘generate_logo’, ‘generate_category_logo’ );
    function generate_category_logo()
    {
    if ( is_category( ‘357’ ) || in_category( ‘357’ ) ) {
    return ‘http://xyz.com/category-logo.jpg’;
    }

    return ‘http://xyz.com/main-site-wide-logo.jpg’;
    }

    #391994
    Leo
    Staff
    Customer Support

    Can you double check that the category ID is correct?

    If so then try this maybe give this a shot:

    add_action( 'after_setup_theme', 'lh_cateory_logo' );
    function lh_cateory_logo() {
        add_filter( 'generate_logo', 'generate_category_logo' );
    }
    
    function generate_category_logo() {
        if ( is_category( 'My Category' ) || in_category( 'My Category' ) ) {
            return 'URL TO CATEGORY LOGO';
        }
    
        return 'URL TO SITE-WIDE LOGO';
    }
    #392172
    Bobby

    Hi Leo,

    I double checked the category id, but it still did not work. I used the new code you provided, but it gave me an error and deactivated my Simple PHP plugin.

    I’m wondering….is this code setup for the nav logo? I’m using the nav logo in the “customize >>>layout >>primary-naviagation section.

    Thanks.

    #392279
    Leo
    Staff
    Customer Support

    Oops wrong quotation marks I think:

    add_action( 'after_setup_theme', 'lh_cateory_logo' );
    function lh_cateory_logo() {
        add_filter( 'generate_logo','generate_category_logo' );
    }
    
    function generate_category_logo()
    {
        if ( is_category( 'My Category' ) || in_category( 'My Category' ) ) {
            return 'URL TO CATEGORY LOGO';
        }
    
        return 'URL TO SITE-WIDE LOGO';
    }
    #392585
    Bobby

    Hi Leo,

    The code you provided is still not working..it deactivated the Simple PHP plugin again. However, the first code you linked me to that Tom provided…does work, but only with the header logo. It does not work with the navigation logo that im using in the “customize >>>layout >>primary-naviagation section.

    #392633
    Leo
    Staff
    Customer Support

    Ahh yeah the filter is for the site logo.

    Can you link me to the site? I might have a solution.

    #393229
    Bobby

    Hey Leo,

    Here’s the link below..

    http://theballerlife.com

    #393276
    Tom
    Lead Developer
    Lead Developer

    Try this instead:

    add_filter( 'generate_navigation_logo', 'tu_category_logo' );
    function tu_category_logo() {
        if ( is_category( 'My Category' ) || in_category( 'My Category' ) ) {
            return 'URL TO CATEGORY LOGO';
        }
    
        return 'URL TO SITE-WIDE LOGO';
    }
    #393283
    Bobby

    Hi Tom.

    That code did not work. Here’s the code im using….

    add_filter( ‘generate_navigation_logo’, ‘tu_category_logo’ );
    function tu_category_logo() {
    if ( is_category( ‘3702’ ) || in_category( ‘3702’ ) ) {
    return ‘http://theballerlife.com/wp-content/uploads/2017/09/baller-wives-life.png’;
    }

    return ‘http://theballerlife.com/wp-content/uploads/2016/12/blife1.png’;
    }

    #393285
    Tom
    Lead Developer
    Lead Developer

    Can you make sure you’re using GPP 1.4.3?

    #393294
    Bobby

    Hmmm…. I just updated to the latest version abd its still not working.

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