- This topic has 25 replies, 3 voices, and was last updated 6 years, 5 months ago by Tom.
-
AuthorPosts
-
September 20, 2017 at 6:11 pm #389100Bobby
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.
September 20, 2017 at 7:38 pm #389123LeoStaffCustomer SupportHi there,
This should help: https://docs.generatepress.com/article/generate_logo/#example
Let me know.
September 20, 2017 at 7:57 pm #389133BobbyHi 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;
}September 20, 2017 at 9:34 pm #389153LeoStaffCustomer SupportSeptember 25, 2017 at 6:35 pm #391919BobbyHello 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’;
}September 25, 2017 at 11:43 pm #391994LeoStaffCustomer SupportCan 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'; }
September 26, 2017 at 6:04 am #392172BobbyHi 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.
September 26, 2017 at 8:11 am #392279LeoStaffCustomer SupportOops 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'; }
September 26, 2017 at 7:56 pm #392585BobbyHi 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.
September 26, 2017 at 10:06 pm #392633LeoStaffCustomer SupportAhh yeah the filter is for the site logo.
Can you link me to the site? I might have a solution.
September 27, 2017 at 6:16 pm #393229BobbySeptember 27, 2017 at 8:18 pm #393276TomLead DeveloperLead DeveloperTry 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'; }
September 27, 2017 at 8:35 pm #393283BobbyHi 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’;
}September 27, 2017 at 8:38 pm #393285TomLead DeveloperLead DeveloperCan you make sure you’re using GPP 1.4.3?
September 27, 2017 at 9:45 pm #393294BobbyHmmm…. I just updated to the latest version abd its still not working.
-
AuthorPosts
- You must be logged in to reply to this topic.