0

I have this php code from a wordpress theme

<?php 

....

$image_source = bloginfo('template_url').'/timthumb.php?src='.$slider_images[$i].'&w=940&h=400&zc=1';
echo "<Image Source='".$image_source."'></Image>";

....
?>

and the expected result is :

<Image Source='http://...timthumb.php?... .png'></Image>

instead of that i get this :

http://... <Image Source='/timthumb.php?.... .png'></Image>

1 Answer 1

1

The bloginfo function prints it's results directly. See reference.

What happens is that when you set $image_source then the bloginfo prints http://... and then returns void. The void value is concatenated with the image url that is '' . '/timthumb... Finally you print the text <image source...>.

You should use get_bloginfo instead

Sign up to request clarification or add additional context in comments.

1 Comment

Use get_bloginfo instead. There was link in the reference to this function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.