Last active
August 29, 2015 14:10
-
-
Save brianpurkiss/a57b6749c6f9d2addc01 to your computer and use it in GitHub Desktop.
A dynamic <title> tag for WordPress that is SEO optimized.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title><?php if ( is_category() ) { | |
echo 'Category Archive for "'; single_cat_title(); echo '" | '; bloginfo( 'name' ); | |
} elseif ( is_tag() ) { | |
echo 'Tag Archive for "'; single_tag_title(); echo '" | '; bloginfo( 'name' ); | |
} elseif ( is_archive() ) { | |
wp_title(''); echo ' Archive | '; bloginfo( 'name' ); | |
} elseif ( is_search() ) { | |
echo 'Search for "'.wp_specialchars($s).'" | '; bloginfo( 'name' ); | |
} elseif ( is_home() || is_front_page() ) { | |
bloginfo( 'name' ); echo ' | '; bloginfo( 'description' ); | |
} elseif ( is_404() ) { | |
echo 'Error 404 Not Found | '; bloginfo( 'name' ); | |
} elseif ( is_single() ) { | |
wp_title(''); | |
} else { | |
echo wp_title( ' | ', false, right ); bloginfo( 'name' ); | |
} ?></title> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment