Displays or retrieves page title for all areas of blog. By default, the page title will display the separator before the page title, so that the blog title will be before the page title. This is not good for title display, since the blog title shows up on most tabs and not what is important, which is the page that the user is looking at. There are also SEO benefits to having the blog title after or to the 'right' of the page title. However, it is mostly common sense to have the blog title to the right with most browsers supporting tabs. You can achieve this by using the seplocation parameter and setting the value to 'right'. This change was introduced around 2.5.0, in case backward compatibility of themes is important.
Affiche ou récupère le titre de la page pour toutes les zones du blog. Par défaut, le titre de la page affiche le séparateur avant le titre de la page, de sorte que le titre du blog précède le titre de la page. Ce n'est pas une bonne chose pour l'affichage du titre, car le titre du blog apparaît sur la plupart des onglets et non sur ce qui est important, à savoir la page que l'utilisateur est en train de consulter. Le fait que le titre du blog soit placé après ou à droite du titre de la page présente également des avantages sur le plan du référencement. Toutefois, le bon sens veut que le titre du blog soit placé à droite dans la plupart des navigateurs prenant en charge les onglets. Vous pouvez y parvenir en utilisant le paramètre seplocation et en lui attribuant la valeur "right". Cette modification a été introduite vers la version 2.5.0, au cas où la rétrocompatibilité des thèmes serait importante.
$sep = '»', $display = true, $seplocation = ''
Sortie :
@param string $sep Optional. How to separate the various items within the page title. @param bool $display Optional. Whether to display or retrieve title. Default true. @param string $seplocation Optional. Location of the separator (either 'left' or 'right'). @return string|void String when `$display` is false, nothing otherwise.
add_filter('wp_title', 'custom_page_title', 10, 2);
function custom_page_title($title, $sep) {
if (is_singular('post')) {
global $post;
$title = $post->post_title . ' | ' . get_bloginfo('name');
}
return $title;
}
Chargement des actualités...