I'm creating a function to handle the titles of the pages, posts, home page etc.. however I have run into a problem.
Here is the code in the Functions.php :
function theTitle() {
$siteName = bloginfo('name');
$sitePage = get_the_title();
if (is_home()) {
echo $siteName;
}
if (is_page()) {
echo "(". $sitePage . ") » " . $siteName;
}
}
When you are on the homepage, the title is:
<title>This is the title specified in settings</title>
However, when you go to an individual page the title is:
<title>This is the title specified in settings(About Us) » </title>
As you can see, it is outputting the $siteName first, instead of adding it to the end. Has anyone come across this before? Do you know why?
Thanks