WordPress.org

Ready to get started?Download WordPress

Forums

Path to image when using an echo (3 posts)

  1. Colleen78
    Member
    Posted 8 years ago #

    I have this code:
    <img src="<?php bloginfo('template_directory'); ?>/images/date.gif" alt="<?php the_time('F dS, Y'); ?>" align="left" style="margin:0 2px 0 0" />

    It works fine but I need to place it in an echo tag for this other part and I am wondering how to do that since you can't seem to put php tags inside an echo statement.

    Thanks.

  2. Austin Matzko
    Member
    Posted 8 years ago #

    The bloginfo and the_time functions include echos in them, so try separating out the various parts:
    echo '<img src="';
    bloginfo('template_directory');
    echo '/images/date.gif" alt="';
    the_time('F dS, Y');
    echo '" align="left" style="margin:0 2px 0 0" />';

  3. Colleen78
    Member
    Posted 8 years ago #

    Thanks very much filosofo, this worked! :D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags