• Resolved 10k-design

    (@10k-design)


    Hi all, I’m working on the Responsive theme, and I need to put some static image on the frontpage, this is the way the theme call it:

    $featured_content = '<img class="alignleft" src="path_goes_here" width="340px" height="100%" alt="" />'; ?>

    I’ve tried to use wp function bloginfo(“template_directory”) to refer to the template path in some ways

    src=”‘<?php bloginfo(“template_directory”); >’/images/img.png”
    src=”‘ bloginfo(“template_directory”) ‘/images/img.png”

    but none of this works… also I’ve tried to define it in a variable and concatenate it in the src path with echo but neither this works…

    anyone can plz help me?

    thx in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    src=”‘<?php bloginfo(“template_directory”); >’/images/img.png”

    You need to close PHP with these characters:

    ?>

    Thread Starter 10k-design

    (@10k-design)

    Thanks so much Andrew but doesn’t work, the problem for me is the double tag <?php

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

    this give me this error

    Parse error: syntax error, unexpected '?' in /web/htdocs/www.etc...

    Thread Starter 10k-design

    (@10k-design)

    this resolve my problem

    ' . get_bloginfo("template_directory") . '

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP noob question template directory T_STRING ERROR’ is closed to new replies.