Created
June 15, 2013 18:51
-
-
Save cpswsg/5789137 to your computer and use it in GitHub Desktop.
Formata o título do site no WordPress.
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
add_filter('wp_title', 'my_wp_title', 10, 2); | |
function my_wp_title($title, $sep){ | |
global $paged, $page; | |
if (is_feed()) { | |
return $title; | |
} | |
// Add o nome do site. | |
$title .= get_bloginfo('name'); | |
// Add a descrição do site para a home. | |
$site_description = get_bloginfo('description', 'display'); | |
if ($site_description && (is_home() || is_front_page())) { | |
$title = "$title $sep $site_description"; | |
} | |
// Add o nuúmero da página se necessário. | |
if ($paged >= 2 || $page >= 2) { | |
$title = "$title $sep " . sprintf(__('Page %s', 'bootstrapwp'), max($paged, $page)); | |
} | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment