• Resolved gavacho13

    (@gavacho13)


    I’m new, I’m pretty HTML illiterate, and I’m trying to do something that seems like it should be really simple, but hasn’t been for me.

    I’m trying to hyperlink my header image to my site’s home page: http://www.obscurityfighter.com/

    I’m using a theme called spacious. This theme allows me to upload a header logo, which by default links to my home page. However, I’m not able to use the logo as my header image because the spacing doesn’t work out correctly in the layout. So, I’ve read several threads on how to hyperlink the header image, but none of the suggestions have worked for me so far:

    http://wordpress.org/support/topic/hyperlink-on-header-image

    I’ve tried editing the header.php file for the theme, and there’s even a custom-header.php file I’ve tried editing, but no luck. It seems that I should be able hyperlink my header image by editing one of those files, but I’m not sure. Are those the right files to edit? Am I failing to edit them correctly?

    Any help would be greatly appreciated! Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • That theme uses a function to display the header image. You need to replace that function with one of your own to add the link. Here are the steps:

    1. Create a Child theme.
    2. Copy header.php from the spacious theme into your child theme folder.
    3. In the copy of header.php, change two instances of ‘spacious_render_header_image()’ to ‘my_spacious_render_header_image()’.
    4. Create a functions.php file in the child theme using the code shown below.
    5. Activate the child theme.

    For functions.php:

    <?php
    function my_spacious_render_header_image() {
       ?>
       <a href="<?php echo bloginfo('url'); ?>" >
          <?php spacious_render_header_image(); ?>
       </a>
       <?php
    }
    
    ?>
    Thread Starter gavacho13

    (@gavacho13)

    vtxyzzy, your instructions worked perfectly for me!:

    http://www.obscurityfighter.com/

    Have to admit that when I saw how involved your fix was, I was nervous. Your instructions were very clear and well written though, so that helped me out.

    Thank you so much. I really appreciate you taking the time to help me out. There’s a lot of negativity on the internet, but it’s nice to be reminded that there are a lot of kind people like yourself who are willing to help complete strangers. God bless you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hyperlink Header Image?’ is closed to new replies.