WordPress.org

Forums

How to link a header image to an external website (2 posts)

  1. kweervegan
    Member
    Posted 1 year ago #

    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

  2. Pioneer Web Design
    Member
    Posted 1 year ago #

    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)

Topic Closed

This topic has been closed to new replies.

About this Topic