Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

do use get_bloginfo() when working with strings;

example:

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

Your Answer

 
discard

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.