WordPress.org

Support

Support » How-To and Troubleshooting » Path to image when using an echo

Path to image when using an echo

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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" />';

    Thanks very much filosofo, this worked! 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Path to image when using an echo’ is closed to new replies.
Skip to toolbar