lowercasing the title
If I'm understanding you correctly, you should be doing:
strtolower(get_the_title());
or
print strtolower(get_the_title());
if you want to display it. Below is an explanation as to why.
the_title() vs. get_the_title()
The function the_title()
prints the current post's title unless you pass false
as its third argument. Unless you call it like:
$title = the_title('', '', false);
The title will be printed, and the $title
variable won't contain anything. This matters because calling strtolower()
on an empty variable doesn't do very much.
You want to use get_the_title()
function in most cases where you're looking to fill a variable with the content posts title.
Note, however, that if you're not currently in a loop, you'll need to pass a post ID to get_the_title()
. In almost all cases when on a single post or page you can do this by using:
get_the_title($post->ID);
as the $post
variable should be in the global scope.
thetitle()
is not a WordPress function.