Forums

[resolved] html in php -- easy question about embedding code (3 posts)

  1. snackd
    Member
    Posted 3 years ago #

    i'm trying to insert an image from somewhere in the header template. i tried this first

    echo '<img src="' . bloginfo('template_directory') . '/../thematicChild/images/greenblue_line.gif" />';

    but it rendered like this:

    http://www.blah.com/wp-content/themes/thematic<img src="/../thematicChild/images/greenblue_line.gif" />

    do you see? it comes out in a different order than i wrote it.
    anyone know why this is???? i fixed easily it like this

    echo '<img src="';
    echo bloginfo('template_directory');
    echo '/../thematicChild/images/greenblue_line.gif" />';

    but that just seems a little ghetto and inefficient.

    suggestions?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    bloginfo() always echoes by default, if I remember correctly. Try using get_bloginfo('template_directory') if you want to use the output in conjunction with <?php echo.

  3. snackd
    Member
    Posted 3 years ago #

    thanks esmi. tres elegant.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.