Archived topic
Custom Logo Link
10 replies · Started by elsa on February 7, 2018
Hi,
I want to have different link for each different logo in the header. So I use following in child theme functions.php
// LOGO LINK
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ((is_woocommerce() && is_product_category(kids)) ||
(is_product_category( array( 'kids', 'kids - bath', 'kids - toilet', 'kids - bedding', 'Baby Bedding', 'Baby Blanket', 'Infant Pillow', 'Kids Bedding', 'Kids Blanket', 'Kids – Decor', 'Kids – Canopies', 'Kids – Decorative Accents', 'Kids – Bank', 'Kids – Cushions & Pillows', 'Kids – Plates & Utensils', 'Kids – Plates', 'Kids – Wall Art', 'Kids – Canvas Wall Art', 'Kids – Wall Decals', 'Kids – Decor', 'Kids – Wall Decor', 'Growth Charts', 'Kids – Mirrors', 'Kids – Wall Hangings', 'Kids – Furniture', 'Playroom', 'Infant Chairs', 'Pools & Pits', 'Kids – Lighting', 'Kids – Floor Lamps', 'Kids – Night Lights', 'Kids – Rugs & Windows', 'Kids – Rugs', 'Boys’ Rugs', 'Girls’ Rugs', 'Nursery Rugs', 'Kids – Storage', 'Kids – Bins & Baskets', 'Kids – Shelves', 'Safety', 'Corner Protectors', 'Door Stoppers', 'Edge Protectors', 'Safety Locks', 'Toys & Gifts' ) )))
return 'http://myweb.com/kids';
}
But it redirects to the same page I currently open. What is wrong?
Hi there,
Likely it's because the conditional statement is wrong.
What are you trying to achieve?
Perhaps we can exclude certain pages instead?
Hi Leo,
I want to have different link for each header. My website consists of 2 big topics: adult & kid. Every topic has its own header, every header has its own logo. So it's like:
1. Topic A - Header A - Logo A. Relevant page & product page: A1, A2, so on. Logo link: myweb.com
2. Topic B - Header B - Logo B. Relevant page & product page: B1, B2, so on. Logo link: myweb.com/kids
How to do this?
Hi Leo,
Can I use image link under header setting for this and upload transparent image for every header? How do I align the transparent image with logo that I upload on the header setting?
Ahh you were using the wrong filter. That one is for logo link.
To swap out for different logo, this is the one you need: https://docs.generatepress.com/article/generate_logo/
What's the logic in topic A and B? Are they categories?
For logo, I can generate different logo for each header.
Topic B consists of products that categorized under "Kids"; and also pages.
Similar logic apply to Topic A. How to do conditional to link 2 header logos to 2 different pages?
Hi Leo,
I resolved this by creating ahref for site title on header setting. But now my title positioning is not correct. How to position this?
<!-- page header -->
Not sure what you mean?
So you are going to use page header instead?
Where would you like to position that?
Yes, I decided to use page header setting to make the grouping easier. I want to position the site title in the center above navigation menu.
Hi, resolved. Thanks.
Awesome :)