Support » Fixing WordPress » Header Image Link and Sidebar Issues

  • Resolved mkgago


    Two things I’d like to do (using default Kubrick template in WP 1.5):

    1. Make my custom header image a link to the home page

    Right now, in header.php I have this line:
    #headerimg { background: url(‘<?php bloginfo(‘stylesheet_directory’); ?>/images/personalheader.gif’) no-repeat top;}

    How do I make that image into a link? (I don’t know if this is what is screwing me up, but I set the display: none for these lines later in header.php:

    <div id=”header”>
    <div id=”headerimg”>
    <h1 class=”invisible”>“><?php bloginfo(‘name’); ?></h1>
    <div class=”invisible”><?php bloginfo(‘description’); ?></div>

    2. How can I make the sidebar appear not just on the home page, but on permalink, category, and archive pages?

    Thanks very much in advance for the help.

Viewing 15 replies - 1 through 15 (of 18 total)
  • <div id="header">
    <div id="headerimg">
    <a href="" title="link to my site"><h1 class="invisible">"><?php bloginfo('name'); ?></h1>
    <div class="invisible"><?php bloginfo('description'); ?></div>

    Just add a link in there.

    See Kubrick’s FAQ’s here.

    Q: How do I make the entire header clickable? Currently, only the header text functions as a link…
    A: Open index.php. Change line 59, from <div id=”header”> to <div id=”header” onclick=”location.href=’http://siteaddress/’;” style=”cursor: pointer;”></div>. This will make the entire header a link.

    I opened up my index.php to make these changes and I swear <div id=”header”> is not a part of the code. If it is in there please tell me WHERE (I looked 10 times and couldn’t find it). If it isn’t any ideas why not and is there still a way to make my header a link? Thanks and here’s what my index.php looks like:

    <?php get_header(); ?>

    <div id=”content” class=”narrowcolumn”>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post”>
    <h2 id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>

    <p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’,”,’|‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>

    <?php trackback_rdf(); ?>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php posts_nav_link(”,”,’« Previous Entries’) ?></div>
    <div class=”alignright”><?php posts_nav_link(”,’Next Entries »’,”) ?></div>

    <?php else : ?>

    <h2 class=”center”>Not Found</h2>
    <p class=”center”><?php _e(“Sorry, but you are looking for something that isn’t here.”); ?>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?>


    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    For anybody else out there having the same trouble I had – I was able to accomplish the same thing by opening up header.php and adding the code from Kubrick’s FAQ minus the </div> at the end. I am not a programmer so if this is wrong I hope somebody will correct me or you will at least not hold me responsible – I just know it worked for me.

    Elitist, I think you did it correctly. I was having the same problems. I think the difference is in the WordPress specific version of Kubrick.

    In the WordPress version of Kubrick, the header is not part of index.php, but resides in its own file: header.php. You will see <div id="header"> at the bottom of the page. Make sure not to accidentally add a second </div> since you already have one at the bottom of the page – and the instructions make it sound like you should add another one. You should not.

    I too am trying to make my custom header image a link to the home page. I’m using Alex King’s “Wallpaper� style sheet with the WP 1.5 theme.

    I’ve tried the suggestions in all the above posts, but am stuck. My header.php file reads:

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>
    <html xmlns=””>

    <head profile=”″>
    <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />

    <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>

    <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats please –>

    <style type=”text/css” media=”screen”>
    @import url( <?php bloginfo(‘stylesheet_url’); ?> );

    <link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php bloginfo(‘rss2_url’); ?>” />
    <link rel=”alternate” type=”text/xml” title=”RSS .92″ href=”<?php bloginfo(‘rss_url’); ?>” />
    <link rel=”alternate” type=”application/atom+xml” title=”Atom 0.3″ href=”<?php bloginfo(‘atom_url’); ?>” />

    <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />
    <?php wp_get_archives(‘type=monthly&format=link’); ?>
    <?php //comments_popup_script(); // off by default ?>
    <?php wp_head(); ?>

    <div id=”rap”>
    <h1 id=”header”></h1>
    <div id=”content”>

    <!– end header –>

    This is all great, and helped me hot-link personalheader.jpg…except for one thing: it doesn’t just link the graphic, its the whole header *section*, background and all that’s linked. This creates a new problem for me, unless I can determine the boundaries of the linked area and make it smaller than the total width/height of the header area. Is the only way to link just the graphic, to simply re-do the image-insertion and associated css from scratch? I can prolly do it, after reading up on horizontal-positioning with div instead of my old standby: tables…(I know, Lorelle: NO TABLES! ;))

    But I thought I’d ask, in case there’s another way to tweak the existing template code before I launch into ripping out whole sections.


    Any suggestions on how to make a part of, rather than the whole, header a hot-link? Preferably the jpeg itself rather than the whole div, as is the case with my site at the moment. The Reason: I can’t place other clickable items into the header if the whole header is hot. If the solution is to re-code without using divs, then so be it. Just hoping someone with more knowledge about this can confirm or deny…


    “Open [header.php]. Change [line 55], from <div id=”header”> to <div id=”header” onclick=”location.href=’http://siteaddress/’;” style=”cursor: pointer;”></div>”

    I also followed these directions from the Bonsai site too, but the problem with my page is that it makes the entire header a link, but it pushes my entries out of the table and jacks up the layout. Any ideas about what this is happening?

    Do not edit the “header” line – you must edit the “headerimg” line to prevent errors :

    <div id=”headerimg”onclick=”location.href=’http://yoursite/’;” title=”Return to Homepage”; style=”cursor: pointer;”>

    Someone who explained it in a way that worked for me, excellent!

    that worked for me too, thanks sf1818. I just added that bit and my whole header links. great

    Thank you elitist – you provided the one explanation that I found that both made sense to me and worked!

    okay i wanted to link my but my index.php (which is the newest downloaded version ) and i dont have a line 59 or <div id=”header”> there.

    so i went to header.php and i changed headering tag to this <div id=”headerimg”onclick=”location.href=’’; style=”cursor: pointer;”>

    and now some pages are out of whack ( ) some dont even display my kubrickheader.jpg ( ) and some are fine ( ) i didnt add an extra div and changed nothing else


    thank you in advance

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Header Image Link and Sidebar Issues’ is closed to new replies.