Archived topic
Linking Navigation Logo To Home Page
13 replies · Started by ilovemusic on April 14, 2018
Hey!
Here back again. Almost done completing my website with your beautiful and flexible builder. I need help with a little issue.
I am currently using my navigation as a header for my webpage and have disabled the site navigation logo. I am wondering how I can link my Primary Navigation Logo to redirect to the home page when someone clicks on it.
At the moment, the logo just refreshes the same page.
Best Regards,
Abhishek Varma
Hi there,
That's weird. It should link to home page by default (this page is using the same method.)
For some reason your navigation logo doesn't have a link which is why is linking to the same page.
Any custom functions to change the navigation logo output?
If not can you try #1 here to eliminate plugin conflict first? https://docs.generatepress.com/article/debugging-tips/
Hi Leo,
Thanks for your reply. I went ahead and checked custom functions.
You are right. This problem is being caused because I've changed my Blog Logo and Url for all my Blog pages and posts.
I've done this using the method you had mentioned earlier
Link to discussion: https://generatepress.com/forums/topic/page-header-logo-change-url/
I added the functions you had asked me:
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_home() )
return 'http://www.ilovemusic.edu.in/Blog';
}
On deactivating this snippet, the home page and other pages URL redirects to the Home Page, however I would still like to keep a different Blog Logo and URL.
Any suggestion??
This is the exact function you are using?
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_home() )
return 'http://yourURL.com';
}
It should only apply to the blog page since there is a conditional tag added.
Yes Leo,
Its exactly that with my Blog URL in the "yourURL" area
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_home() )
return 'http://www.demo.ilovemusic.edu.in/Blog';
}
- The Logo's on the Pages still just refreshes the page
- The Blog logo re-directs correctly to the Blog Page.
Actually I just noticed that your blog page is not the default WordPress blog page. It is just a static page built from Elementor
Can you try this instead?
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
is_page( 'erg-services' ) {
return 'http://test.ergapc.co.uk/erg-services/';
}
return 'http://HomePageURL.com';
}
Also what are you using to switch the logo?
Hey Leo,
My apologies, should have mentioned that!
I used the Snippet you provided above.
However, no change.
- The Blog Logo redirects correctly to the Blog URL.
- But the Normal Logo on our course pages and other pages, just refreshes the pages. :(
Regards,
AV
Can you try the edited code above?
https://generatepress.com/forums/topic/linking-navigation-logo-to-home-page/#post-554902
Hey Leo,
So the code works. However there is one last issue.
The Blog logo is not redirecting to the Blog main page on individual posts for the Blog.
It redirects to the Home Page of the Website.
Any way of sorting that?
Edited the code again.
Let me know.
Hey Leo,
So I updated with the new edited code that you edited above, which was...
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_page( 2467 ) && is_single() ) {
return 'http://www.demo.ilovemusic.edu.in/blog';
}return 'http://www.demo.ilovemusic.edu.in';
}
However this still doesn't do whats required and also unlinks the Blog Main Page URL with the Blog and now redirects to home page. :(
I'm using the Generate Header option to change the logo for our Blog Page as suggested by Tom earlier.
Hey Leo,
Thank You! It works fine now!!
Best Regards,
Abhishek V
Team I Love Music Academy
No problem :)