Skip to content

Instantly share code, notes, and snippets.

@cpswsg
Created June 15, 2013 18:51
Show Gist options
  • Save cpswsg/5789137 to your computer and use it in GitHub Desktop.
Save cpswsg/5789137 to your computer and use it in GitHub Desktop.
Formata o título do site no WordPress.
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