Remove Header Image Link
-
I want to remove the link of my header image. I want to keep the header image. I already created a child theme and created a header.php folder.
-
header.php is a file, not a folder.
Copy header.php from the parent into the child theme, than paste the content into gist.github.com and paste a link to that here so we can take a look.
<?php /** * The header for our theme. * * Displays all of the <head> section and everything up till <div id="content"> * * @package Simppeli */ ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <?php wp_head(); ?> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-69391497-1', 'auto'); ga('send', 'pageview'); </script> </head> <body <?php body_class(); ?>> <div id="page" class="hfeed site"> <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'simppeli' ); ?></a> <header id="masthead" class="site-header" role="banner"> <?php if ( get_header_image() && is_front_page() ) : // Header image. ?> <a class="header-image-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> <img class="header-image" src="<?php header_image(); ?>" width=463"<?php echo esc_attr( get_custom_header()->width ); ?>" height=158"<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" /> </a> <?php endif; // End header image check. ?> <div class="site-branding"> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <div class="site-description"><?php if ( is_front_page() ) : echo get_bloginfo ( 'description' ); endif; ?></div> <?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?> </header><!-- #masthead --> <div id="content" class="site-content">I asked you to do it in gist, NOT to paste the code here, so I could reference link numbers.
remove the stuff that starts with
<a class. Leave the<imgline. Remove the closing</a>.Note that you degrade the user experience doing this. People expect the header logo to be a link to the home page.
That did the trick! I thank you for the advice. The header image is only shown on the Homepage because I could not figure out how to display a smaller logo on the other pages. Instead I placed a Home button on the menu. I will consider your advice and display the logo for people to use as a home page link. Thank you for your time and help, it is greatly appreciated.
The topic ‘Remove Header Image Link’ is closed to new replies.