Help getting the page title into a variable.
-
Hey, I’ve been working on this for hours and can’t figure it out. I’d like to use the page title in a selection statement in order to display the sidebar only on the blog page. So I have:
$theTitle = wp_title(”,false,”);
if ($theTitle == “Blog”) get_sidebar();
Now when I do:
echo $theTitle;
I get “Blog”. But for some reason, the if statement doesn’t run. So then I tried adding this before the if statement and it ran:
$theTitle = “Blog”;
So wp_title() must not be returning what I think it’s returning. Can anybody clue me in? Maybe I think I’m missing something.
Thanks
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Help getting the page title into a variable.’ is closed to new replies.