I’m trying to muck around with some strings in PHP in my Wordpress theme. Can anyone imagine why this code wouldn’t work?
<?php $str = the_title(); $str = strtolower($str); $str = str_replace(" ","-", $str); echo $str; ?>
I’m taking the page title, converting it to lower case, and replacing strings with hyphens. I haven’t tested with any pages with spaces yet. The page title is echoed, but it seems as if the strtolower function has not run on the string. Any help is greatly appreciated.