Skip to content

Instantly share code, notes, and snippets.

@meetbryce
Last active July 19, 2021 16:33
Show Gist options
  • Save meetbryce/850d11fe4e0741d45d54 to your computer and use it in GitHub Desktop.
Save meetbryce/850d11fe4e0741d45d54 to your computer and use it in GitHub Desktop.
Best Practice Wordpress Theme Title Code
<title><?php
if (is_home () ) { echo sprintf('The %s Blog', get_bloginfo(‘name’)); }
elseif ( is_category() ) { single_cat_title(); echo ‘ - ‘ ; bloginfo(‘name’); }
elseif (is_single() ) { echo sprintf('%s – The %s Blog', single_post_title(false), get_bloginfo(‘name’));}
elseif (is_page() ) { single_post_title();}
else { wp_title('',true); echo sprintf(' Blog – %s', get_bloginfo(‘name’));}
?></title>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment