WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how to link header image? (23 posts)

  1. grapefruitgirl
    Member
    Posted 8 years ago #

    how does one link a header image from every page (including single entry pages)?

    im new to php so not sure how the html woudl fit with the header image php.

    can anyone assist?

  2. Samuel B
    moderator
    Posted 8 years ago #

    Look in your theme's style.css for something like:
    #headerimg
    or #header

    Put your definitions there.

  3. grapefruitgirl
    Member
    Posted 8 years ago #

    sorry, i should probally know this, but how do you add a url to css code?

  4. vkaryl
    Member
    Posted 8 years ago #

    Can you do that? I didn't think it was possible. You can link the entire header using either the #headerimg or #header div by adding in a piece of js, so your div looks like this:

    <div id="headerimg" onclick="location.href='http://www.yoursite.com';" style="cursor: pointer;">

    You may have to play with it a little to figure out which div is best for it.

  5. grapefruitgirl
    Member
    Posted 8 years ago #

    in what files should i add this div tag?

    I tried adding it to the "header.php" and the "main index template.php" and still no go....?

    also, is there any particular spot on the page page where i should put this tag, or can it go anywhere?

    thanks for your help!

  6. vkaryl
    Member
    Posted 8 years ago #

    Well, generally (depending on theme), those divs will be found in header.php.

    Could you give a link?

  7. grapefruitgirl
    Member
    Posted 7 years ago #

    ok, so i found the code on my header.php located here:

    <div id="header">
    <div id="headerimg">
    <h1>"><?php bloginfo('name'); ?></h1>
    </div>
    </div>

    here is the url I'd like linked from the header image:

    http://www.grapefruitgirl.com/edibles/

  8. vkaryl
    Member
    Posted 7 years ago #

    <div id="header">
    <div id="headerimg" onclick="location.href='http://www.grapefruitgirl.com/edibles';" style="cursor: pointer;">
    <h1><?php bloginfo('name'); ?></h1>
    </div>
    </div>

    Copy n paste that over what's there and see if it works like you envision.

  9. lqz
    Member
    Posted 7 years ago #

    This is the code I have for want you want to do hope it works.

    <div id="header" onclick="location.href='<?php bloginfo('url'); ?>';" style="cursor: pointer;"

    <a href="<?php bloginfo('url'); ><?php bloginfo('name'); ?></a>

    <div id="description"><?php bloginfo('description'); ?></div>

    Replace the code you posted with this, you then have that go into your CSS file and add the image you want to background under #header.

  10. grapefruitgirl
    Member
    Posted 7 years ago #

    vkaryl, i tried the code you listed and it actually didnt link the header image and also took away the sidebar images on my page ?? i replaced the exact code i listed above with what you posted. strange.

    lqz, i'd like to try your solution, but not sure how the header image code would look in the css. here is how the #header code currently looks in my stylesheet:


    #header {
    background-color: #000000;
    }

    help?

  11. grapefruitgirl
    Member
    Posted 7 years ago #

    anyone?

    surely this is possible...

  12. yosemite
    Member
    Posted 7 years ago #

    This works for me:
    <div id="header" onclick="location.href='<?php echo get_settings('home'); ?>/';" style="cursor:pointer;">

  13. grapefruitgirl
    Member
    Posted 7 years ago #

    Thanks Yosemite.

    I actually already have this code in my header.


    <div id="header">
    <div id="headerimg">
    <h1>"><?php bloginfo('name'); ?></h1>
    </div></div>

    but where do you put the url that you want the image to link to? i'm not seeing where that link info will go.

    (i'm still new to php)

    thanks for any help you can offer!

  14. grapefruitgirl
    Member
    Posted 7 years ago #

    it seems im making this more complicated than it needs to be....but i can seem to make this work...

  15. flashpal
    Member
    Posted 7 years ago #

    I'm having the same problem grapefruit girl. I know if I go into options and type in a weblog title then it's going to name the blog site and it creates a link that I can click with the URL of my blog site. But that name I type in has to go somewhere in some file, right? If I could just find what file that ends up in, I could change it.

    Here's my blog http://swamptropolis.com/swamptropolis/

    It seems I can have my nice picture with my own text, but no link in the header, or I can have a nice picture and skip my own text and type in 'swamptropolis' in options in the weblog title space and get the link back

    It's just that if I typed in 'swamptropolis' in that space and that names my blog and gives me a link in the header, shouldn't swamptropolis show up in some file somewhere?

  16. flashpal
    Member
    Posted 7 years ago #

    grapefruit girl, this one worked for me!

    <div id="header"onclick="location.href='<?php bloginfo('url'); ?>';" style="cursor: pointer;">
    <div id="headerimg">
    </div>
    </div>

    Don't change anything in it. Don't put in your URL address or anything else. Just copy and paste that exactly as it is, save it and upload it.

  17. grapefruitgirl
    Member
    Posted 7 years ago #

    hi flashpal,

    cool, but where do you designate what url the image should go to?

    -grapefruit

  18. yosemite
    Member
    Posted 7 years ago #

    gfg: It's already defined by <?php bloginfo('url'); ?>.

  19. grapefruitgirl
    Member
    Posted 7 years ago #

    yeah!! it finally works. thanks to all who helped me figure this out. it's much appreciated =)

    here's the code that worked for me, in case anyone's interested:

    <div id="header"onclick="location.href='<?php bloginfo('url'); ?>';" style="cursor: pointer;">
    <div id="headerimg">
    </div>
    </div>

  20. rrob13
    Member
    Posted 7 years ago #

    Thanks, y'all. This worked like a charm and was exactly what I needed.

    Rob

  21. lilypetals
    Member
    Posted 7 years ago #

    that code didn't work for me. :( any other ways? i've been searching for threads on this but no codes worked.

  22. ViperIII
    Member
    Posted 7 years ago #

    <div id="header"onclick="location.href='<?php bloginfo('url'); ?>';" style="cursor: pointer;">

    This one works best !!!!

    But however, in my Theme there is a search bar within the HeaderIMG:

    <div id="header">
    	<div id="headerimg"><?php include (TEMPLATEPATH . '/searchform.php'); ?>
    	</div>

    So whenever I want to enter something in the search bar, I click the link.
    Can you fix this somehow????

  23. manny75586
    Member
    Posted 7 years ago #

    you guys are awesome. the last code gfg posted worked for me like a charm. thanks!

    I really gotta crack open a book on PHP. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.