Archived topic
Different logo and link to my blog page and single post
12 replies · Started by Feber on April 11, 2022
Hi there,
I have made an element for my blog and single page logo. It works.
I have 2 different logos. 1 for my pages and the other for blogs+single post.
But both logos linked to my homepage.
I want the logo for my blog and single post linked to my blog page.
How to do that ?
If it in PHP, where can I put the code ? Is it in functions.php or how to do it easily ?
Thanks
Hi there,
Try this:
1. The logo you use on your Posts and Blog should be the one set in the Customizer > Site Identity.
2. Use the Header Element to change the logo for your pages.
3. you can use this PHP Snippet to change the default logos URL when viewed on a single post:
add_filter( 'generate_logo_href', function($url) {
if ( is_single() ) {
$url = "your_blog_page_URL";
}
return $url;
} );
change the your_blog_page_URL to your sites blog url
hi there,
it's not working.
anything wrong from my side ?
Try:
add_filter( 'generate_logo_href', function($url) {
if ( is_single() ) {
$url = "your_blog_page_URL";
}
return $url;
}, 99, 1 );
not working. still the same
Can you clear and disable your caching plugin first?
Let me know :)
I dit. But nothing change
Hi Feber,
Your site link doesn't work on my end, I just tested the code and it worked well.
How did you add the code?
And can you disable all plugins except GP premium and the plugin you added PHP code with to eliminate plugin conflicts?
I use 2 different php snippet plugin. stil nothing change.
now it works in single post.
but not in blog.
Oh I see, you want single post pages and blog page use the same URL?
If so, try this code instead:
add_filter( 'generate_logo_href', function($url) {
if ( is_single() || is_home() ) {
$url = "your_custom_URL";
}
return $url;
}, 99, 1 );
Replaceyour_custom_URL with your URL.
yeahhh.... thank you so much.
it works. thank you
No problem :)