Site logo

Archived topic

Logo specific link, staging site to prod site.

3 replies · Started by movingwaldo on April 13, 2017

Viewing posts 1–4 of 4

Hi !

I needed to change the link on my logo for some pages. So I used the generate_logo_href filter
like this :
add_filter( 'generate_logo_href','generate_custom_logo_href' );
function generate_custom_logo_href()
{
// Enter the URL you want your logo to link to below
return 'http://NEW-URL-HERE';
}

It's working perfectly but my problem is that I did that on my staging site so the logo is linking to my staging site.
Is it possible that when I update my site from staging to prod, the link (which is a staging link) I put in my filter is automatically updated for a link on my prod site ?

For example, here is my filter for my staging site :

add_filter( 'generate_logo_href','tu_add_custom_logo_href' );
function tu_add_custom_logo_href( $url )
{
if ( is_page( 'courtier-remax' ) ) {
return 'http://staging.charliedemenage.com/fr/courtier-remax/';
}
if ( is_page( 'remax-broker' ) ) {
return 'http://staging.charliedemenage.com/remax-broker/';
}

// All the other pages
return $url;
}

You can see the links are http://staging.
And this is what I need it to be for my prod :

add_filter( 'generate_logo_href','tu_add_custom_logo_href' );
function tu_add_custom_logo_href( $url )
{
if ( is_page( 'courtier-remax' ) ) {
return 'https://www.movingwaldo.ca/fr/courtier-remax/';
}
if ( is_page( 'remax-broker' ) ) {
return 'https://www.movingwaldo.ca/remax-broker/';
}

// All the other pages
return $url;
}

Here the link is https://www.movingwaldo.ca/

Is there an other way to change the logo link so it will update it automatically or maybe add a script ??

Thank you for your answer !

Alex

Hi Tom,

Thanks it worked !

You're welcome :)

This archived topic is closed to new replies.