WordPress.org

Ready to get started?Download WordPress

Forums

Converting HTML with images to PHP (3 posts)

  1. badscenemyfault
    Member
    Posted 3 years ago #

    I've been struggling with this problem for about a week now, and figured it might be time to put it to the forum. I built a custom theme in CSS/HTML, and am currently trying to convert it to PHP via Bitnami. All of the images I have coded into HTML, however, don't work in PHP. I would just convert all of my images to CSS, but my main image is an image map, and I need it to be coded in HTML to work. Is there some trick to switching HTML code for images when converting to PHP? If it helps, this is the code I've been working with:

    <div id="tape">
    <img src="images/tape.png" usemap="#about" border=0>
    <map name="about">
    <area shape="rect" coords="175, 25, 250, 65" alt="about" href="http://sarahmichellecollins.com/about">
    <area shape="rect" coords="270, 25, 345, 65" alt="writing" href="http://sarahmichellecollins.com/writing">
    <area shape="rect" coords="355, 25, 415, 65" alt="blog" href="http://sarahmichellecollins.com/blog">
    </map>
    </div>

    Anyone that can help me would be a lifesaver.

  2. Connor Montgomery
    Member
    Posted 3 years ago #

    Hi badscenemyfault,

    Preface all of your "images/name.png"'s with <?php bloginfo('template_directory'); ?>, so for example:

    src="<?php bloginfo('template_directory'); ?>/images/name.png"

    The reason that it's not working is because it's not looking in the theme folder for your images, it's looking at the root of the website. We need it to be looking at /images inside of the active theme. Make sense?

    Best,
    Connor

  3. badscenemyfault
    Member
    Posted 3 years ago #

    Thank you so much! It worked like a charm!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags