I was working on a header that could be used universally for my site. Unfortunately, this also includes a lot of conditional checking for WordPress functions, so that I end up with the correct data for headings. I have a piece of code that checks to see if the function that provides a title for WordPress pages exists. If it does, it then checks to see if that function returns anything. If it doesn’t, it prints a default title. Otherwise, it prints the title and appends a standard title to it. My problem is that it seems to print the title, and then appends the default title. So instead of printing: “pageTitle-append” it prints “pageTitleStandardTitle-append”. Here’s my code:
if(function_exists('wp_title')):
if(wp_title()):
wp_title();
echo ' - Standard Appended Title';
else:
echo 'Blog - Standard Appended Title';
endif;
else:
echo $title.' - Standard Appended Title';
endif;
This should do it :