Archived topic
Remove logo link
15 replies · Started by Nicholas on December 19, 2017
Hi, I'd like to remove the link in the header logo completely. I saw another thread with instructions on how to change it, but what do I do if I want the link to be gone entirely? I just want the logo, no link. Thanks so much!
Hi there,
Check out the last example on this page: https://docs.generatepress.com/article/generate_logo_output/
Ah, perfect! Thanks so much.
You're welcome! :)
This works for me. However, it serves up the standard logo. Is there a way to still serve up the retina logo on devices that could use it?
Hi there,
I just updated the code in the article - can you try now?
Let me know :)
Fantastic. It works great now. Thank you!
You're welcome! :)
I'm back. I was trying to poke around with accomplishing this same thing with the generate_navigation_logo_output filter as I'm also using a sticky nav on the site, but couldn't get it figured properly. Could anyone help me out with sorting that?
Give this a shot:
add_filter( 'generate_navigation_logo_output', 'tu_remove_nav_logo_link' );
function tu_remove_nav_logo_link( $output ) {
if ( ! function_exists( 'generate_menu_plus_get_defaults' ) ) {
return $output;
}
$settings = wp_parse_args(
get_option( 'generate_menu_plus_settings', array() ),
generate_menu_plus_get_defaults()
);
return sprintf(
'<div class="site-logo sticky-logo navigation-logo">
<img class="header-image" src="%1$s" alt="%2$s" />
</div>',
esc_url( apply_filters( 'generate_navigation_logo', $settings['sticky_menu_logo'] ) ),
esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
);
}
Getting a broken image with that. I think $settings['sticky_menu_logo'] may need to be defined.
Ah yea, you're right. Just adjusted the code :)
Works most excellently now. Thank you!
You're welcome :)
Hi Tom,
how can i remove the logo link on the page-hero?
Thanks and best regards,
Dominik