WordPress.org

Support

Support » How-To and Troubleshooting » How to link a header image to an external website

How to link a header image to an external website

  • kweervegan
    Member

    @kweervegan

    Hi,

    I’m creating a website for a business I work for, and there’s a few images I’m placing in the header. The first image works like a home button for the site, which I have worked out already. The second image is basically a logo that should link out to another site on the internet, but I’m having trouble working out what form the PHP should take in the header.

    Currently have every set up in WAMP.

    For the first image I used the code:

    <a href="<?php echo get_option('home'); ?>/"><img src="http://localhost/wordpress/wp-content/themes/Computer%20Help/images/comp-help-logo.png" alt="Computer Help" width="65" height="84" title="Computer Help" />

    Is there a way to vary that to include a link out to an external site?

    Thanks,

    Tim

Viewing 1 replies (of 1 total)
  • Pioneer Web Design
    Participant

    @swansonphotos

    Change this:

    <a href="<?php echo get_option('home'); ?>/">

    to this example (replace siteurl)

    <a href="http://www.siteurl.com/">

    As for the rest, is that the image you want displayed?

    Side Note: You can also use PHP to pull the theme url so when you go live you will not have to replace the url with the real one.

    <img src="<?php get_template_directory(); ?>/images/comp-help-logo.png" alt="Computer Help" width="65" height="84" title="Computer Help" />

    So then we have:

    <a href="http://www.siteurl.com/"><img src="<?php get_template_directory(); ?>/images/comp-help-logo.png" alt="Computer Help" width="65" height="84" title="Computer Help" /></a>

    (and note I closed the <a> tag there)

Viewing 1 replies (of 1 total)
  • The topic ‘How to link a header image to an external website’ is closed to new replies.