Get 25% off GP Premium with the discount code: BLACKFRIDAY17

Premium support

Please log in to post in these forums. If you didn't create an account when you purchased, please contact us.

Free support

If you haven't purchased GP Premium, support for the free theme can be found on WordPress.org.

[Resolved] Change Nav Logo For Different Category Pages

Home Forums Support Change Nav Logo For Different Category Pages

This topic contains 25 replies, has 3 voices, and was last updated by  Tom 1 week, 2 days ago.

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

    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

    Hi there,

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

    Let me know.

    Want to help support GP? Please consider leaving us a review!
    https://wordpress.org/support/theme/generatepress/reviews

    #389133

    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
    #391919

    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

    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';
    }

    Want to help support GP? Please consider leaving us a review!
    https://wordpress.org/support/theme/generatepress/reviews

    #392172

    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

    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';
    }

    Want to help support GP? Please consider leaving us a review!
    https://wordpress.org/support/theme/generatepress/reviews

    #392585

    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

    Ahh yeah the filter is for the site logo.

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

    Want to help support GP? Please consider leaving us a review!
    https://wordpress.org/support/theme/generatepress/reviews

    #393229

    Hey Leo,

    Here’s the link below..

    http://theballerlife.com

    #393276

    Tom
    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

    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

    Can you make sure you’re using GPP 1.4.3?

    #393294

    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.