WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

as i am a newb here, please help me to get this solved.

i am trying to add a function in wordprress functions.php where i am trying to display an image relevant to my theme folder

here is my code which is not working, it only shows the file name but without the correct path.

add_filter (somefilter_code_here);
function mycustom_func($mycustom_field ) {
$capimg =  bloginfo('template_url').'/imagename.jpg'; 
echo $capimg; // for  testing and it does work
$mycustom_field .= '<p class="custom_image">';
//$comment_field .= '<img scr="'. $capimg' . '" alt="custom_image"/>';
$mycustom_field .= '<img scr="'. bloginfo('template_url').'/imagename.jpg'   . '"    alt="captcha"/>';  
$mycustom_field .= "</p>";
return $comment_field;

i need an exact php line which can retrieve image from path and display it

right now image is not displayed, it show only file name and the value of $capimage is shown separately

share|improve this question

do use get_bloginfo() when working with strings;


$capimg =  get_bloginfo('template_url').'/imagename.jpg';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.