- This topic has 19 replies, 3 voices, and was last updated 3 years, 7 months ago by David.
-
AuthorPosts
-
April 7, 2020 at 5:55 pm #1230588Jefri
Hello,
The website URL is below.
I cannot remove the link on the logo in primary navigation. Is there a way to disable this link (but still have the logo showing)?
Thank you.
April 7, 2020 at 7:11 pm #1230622LeoStaffCustomer SupportHi there,
Are you still using an old version of GP Premium 1.7.7?
If so can you upgrade to the latest version 1.9.1?
https://docs.generatepress.com/article/updating-gp-premium/Then remove the navigation logo from Customizer > Primary Navigation.
Then activate this option:
https://docs.generatepress.com/article/navigation-as-a-header/Then you should get the exact same layout but works better.
After that I can provide the filter to remove the logo link.
Let me know ๐
April 7, 2020 at 9:52 pm #1230714JefriHello I did this and published it. Thanks.
Can you please tell me how to remove the link on the logo now?
Thanks.
April 8, 2020 at 10:01 am #1231575LeoStaffCustomer SupportNow try this:
add_filter( 'generate_logo_output', 'tu_no_logo_link', 10, 3 ); function tu_no_logo_link( $output, $logo_url, $html_attr ) { printf( '<div class="navigation-branding"> <div class="site-logo"> <img %1$s /> </div> </div>', $html_attr ); }
Adding PHP: https://docs.generatepress.com/article/adding-php/
April 8, 2020 at 5:05 pm #1231941JefriHi Leo,
I tried your code and it worked on all pages except my home page (with the transparent header).
On my home page I am using the header element and now the logo is missing only on this page.
Can you please tell me a way to continue to show the logo on the home page?
https://testingmastery.com.au/teacherathome
Thank you.
April 9, 2020 at 9:03 am #1232827TomLead DeveloperLead DeveloperThat’s strange, can you remove the function Leo provided so I can take a look at the code?
April 9, 2020 at 5:26 pm #1233345JefriHi Tom,
I disabled the code snippet. Thank you.
April 9, 2020 at 5:27 pm #1233347JefriSo now the logo is showing on the home page but the link on the logo image still exists (which I do not want).
Thanks.
April 9, 2020 at 6:10 pm #1233366TomLead DeveloperLead DeveloperHmm, very weird – that filter isn’t used in the Header Element at all.
Let’s try this:
add_filter( 'generate_logo_output', function( $output, $logo_url, $html_attr ) { if ( is_page( 22 ) ) { return $output; } printf( '<div class="navigation-branding"> <div class="site-logo"> <img %1$s /> </div> </div>', $html_attr ); }, 10, 3 );
April 9, 2020 at 7:56 pm #1233422JefriHi Tom, I used the snippet but the problem happened again. The page: https://testingmastery.com.au/teacherathome uses the header elementand the logo disappears.
April 10, 2020 at 9:40 am #1234224TomLead DeveloperLead DeveloperCan you try the updated code?: https://generatepress.com/forums/topic/removing-link-on-the-website-logo-in-primary-navigation/#post-1233366
April 11, 2020 at 1:03 am #1234828JefriHi Tom,
Thanks, I tried the code. Now on the home page testingmastery.com.au/teacherathome
the logo is showing at the top. However, the link to the home page still exists on this page when you can click on the logo.
The other pages work perfectly (the logo in the navigation does not have a link).
Is there a way I can remove the link on the logo on the page:
testingmastery.com.au/teacherathome ?Thank you.
April 11, 2020 at 10:38 am #1235457TomLead DeveloperLead DeveloperLet’s try this:
add_filter( 'generate_page_hero_logo_output', function( $output, $logo_url, $html_attr ) { return sprintf( // WPCS: XSS ok, sanitization ok. '<div class="site-logo page-hero-logo"> <img %1$s /> </div>', $html_attr ); }, 10, 3 );
Let me know ๐
April 11, 2020 at 6:12 pm #1235769JefriHi Tom,
Thanks. so I put in Both snippets that you provided me.
And now everything is perfect except on the home page https://testingmastery.com.au/teacherathome
the stick navigation logo still has the link attached to it. Can this be removed?Please note the stick navigation logo does not have a link (which is what I want) on the other pages.
Thanks for your help.
April 12, 2020 at 9:35 am #1236375TomLead DeveloperLead DeveloperAh, no filter exists there. I’ve made a note to add one/make this process more simple.
For now, you can do this:
.navigation-stick .site-logo a { pointer-events: none; }
-
AuthorPosts
- You must be logged in to reply to this topic.