Reputation: 21
Here is the code I'm using:
<img src="/images/<?php strtolower(the_title()); ?>.jpg" border="0" >
Upvotes: 0
Views: 411
Reputation: 1858
Wordpress the_title() function echoes the title by default. You need to set the echo argument to false and echo the lowercase output yourself.
<img src="/images/<?php echo strtolower(the_title('','',false)); ?>.jpg" border="0" />
Upvotes: 4
Reputation: 219844
It looks like the_title()
actually echo's out the title since you don't have an echo statement in your snippet. So your call to strtolower()
is basically doing nothing. You'll need to capture the output of the_title()
then you can convert it to lower case.
ob_start();
the_title();
$title = $template = ob_get_clean();
<img src="/images/<?php echo strtolower($title); ?>.jpg" border="0" />
Upvotes: 0