I am sure this is simple, but I don’t get why…
Why is this wrong?
echo "<img src='".bloginfo('template_directory')."/systemdata/next.png' border=0 id='NavImage'>";
If I do it like this, it works:
echo "<img src='";
echo bloginfo('template_directory');
echo "/systemdata/next.png' border=0 id='NavImage'>";
What do I do not get? I want to write nice code and the second example is not very elegant I think.
Thanks!
You are using the wrong function,
bloginfo()
already outputs / echoes so you cannot use it when you want to concatenate strings (nor should youecho
it…).Instead you could use
get_bloginfo()
as that returns a string:You can try this as far as code elegant factor is concerned: