Site logo

Archived topic

Site logo pointing to different page

5 replies · Started by Sam on February 20, 2020

Viewing posts 1–6 of 6

Hi everyone!

I'm very happy with my generatepress journey!
But I'll allways find something to improve...

What I'm willing to do now:
I created an online store in the site sementesdamor.pt.
Using the elements, I created an alternative header, with a slightly different site logo for the store pages.
What I'd like to achive, if possible without over complicating things is to know if it is posilbe for the site logo that links to the home page to link to the shop page in those pages where I have an alternative header.

PS: I think that my site actually looks nice (thanks to GP Premium, of course), so you can showcase it any time.

Thanks in advance!
Saul

Hi Leo!
Thanks for your reply.

This is what I have so far, I know it's incomplete:

if (  the_hook_name??? () ) {
add_filter( 'generate_logo_href', 'generate_newlogo_href' );
function generate_newlogo_href()
{ 
    return 'https://www.sementesdamor.pt/loja/';
}
}

I wonder...
can I insert the code in the element directly? In that case, what are the parameters?
Or I'll need to create a code snippet? In that case, what is the hook name?

Hi there,

It can't be added to an Element, but you can target your store.

For example:

add_filter( 'generate_logo_href', function( $href ) {
    if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
        $href = 'URL TO YOUR STORE';
    }

    return $href;
} );

Let me know if that helps or not :)

Hi Tom and Leo!

I created a codde snippet according to your code. It worked.
Thanks!

You're welcome :)

This archived topic is closed to new replies.