WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] I can't get HTML to display an image in header of my local host site (3 posts)

  1. ContraCosta
    Member
    Posted 3 years ago #

    I am trying to customize my theme with social icons on my local host.
    But no matter what path I give the img src no image displays in the heading (I also tried to upload different images through html code across the site with no success). I am using MAMP. The images are located in my local host folder under wp-content/themes/theme/images

    I wrote this in the CSS:

    .custom #social-icons a img {
    float: right;
    margin-left: 0.3em;
    }

    and this in the header.php:

    <div id="social-icons">
    <a href="http://www.facebook.com"><img src="images/facebook_icon.png" width="32" height="32" alt="Facebook" /></a>
    </div>

    I appreciate the help. Thank You!

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    try and use an absolute image path;
    example:
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/facebook_icon.png" width="32" height="32" alt="Facebook" />
    http://codex.wordpress.org/Function_Reference/bloginfo

  3. ContraCosta
    Member
    Posted 3 years ago #

    Wow! That works well. So do you have to use PHP code when you want to add an image in a php document, or that just for local hosts? I'm confused because I thought you could use HTML...

    Anyway thanks a million.

Topic Closed

This topic has been closed to new replies.

About this Topic