Skip to content

Instantly share code, notes, and snippets.

@salmanbd96
Created August 7, 2015 19:46
Show Gist options
  • Save salmanbd96/a52cb6bc245e93fc1758 to your computer and use it in GitHub Desktop.
Save salmanbd96/a52cb6bc245e93fc1758 to your computer and use it in GitHub Desktop.
Adding this code to your wordpress theme will dynamically create a title.
<title><?php
if (is_home()) { echo bloginfo('name');
} else if (is_404()) {
echo '404 Not Found';
} else if (is_category()) {
echo 'Category:'; wp_title('');
} else if (is_search()) {
echo 'Search Results';
} else if ( is_day() || is_month() || is_year() ) {
echo 'Archives:'; wp_title('');
} else {
echo wp_title('');
}
?></title>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment