Site logo

Archived topic

Change Nav Logo For Different Category Pages

25 replies · Started by Bobby on September 20, 2017

Viewing posts 16–26 of 26

Hello Tom,

I ran into a problem since updating to your newest update.

After updating to GPP 1.4.3, everything was working just fine....the logo changed for the specific category and the main logo remained the same on the homepage. Well, yesterday, after updating to Version 1.5.2, the logo on the main homepage switched to the category logo. I removed the code for the category logo and the main logo re-appeared back to normal... it looks like the code you provided me is no longer working since i updated to version 1.5.2.

Here's the code im using below:

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

Thanks.

Hmm that code should still work.

Can you add the code back in and link us to the page that isn't working?

Thanks!

Hi,

I just put the code back in and the logo on the homepage switch to the category logo. When i take the code out, the original logo re-appears and the category logo disappears.

http://theballerlife.com/

Maybe try this:

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

    return $logo;
}

Hello Tom,

It works but not like the other code. The code you gave me changes the logo on the specified category, but when a person clicks "read more" to go to the story, the logo switches back to the main logo. The other code covered all the logo changes. I tried the original code and just changed the "return" to $logo;...but that did not work.

Any suggestions? Thanks.

That code doesn't cover being inside categories.

For that, you'd need to do this:

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

    return $logo;
}

Hi Tom,

Yes, this is the code i tried and it changed the homepage logo back to the category logo. Strange??? Before I updated to the newest version 1.5.2...the prior code worked for everything. Hmmm....Should I go back to the last version??

Definitely not. Try this instead:

add_filter( 'generate_navigation_logo', 'tu_category_logo' );
function tu_category_logo( $logo ) {
    if ( is_category( 'test-cat' ) || ( in_category( 'test-cat' ) && is_singular() ) ) {
        return 'http://theballerlife.com/wp-content/uploads/2017/09/baller-wives-life.png';
    }

    return $logo;
}

Just confirmed that it's working :)

Perfect!!! It's working again! Thanks for all your help.

Take care.

You're welcome :)

This archived topic is closed to new replies.