Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp_title Support #8

bueltge opened this issue Nov 3, 2014 · 0 comments

wp_title Support #8

bueltge opened this issue Nov 3, 2014 · 0 comments


Copy link

bueltge commented Nov 3, 2014

Changes for WP 4.1 at wp_title()

Add support in inc/setup.php

 * Let WordPress manage the document title. 
 * By adding theme support, we declare that this theme does not use a 
 * hard-coded <title> tag in the document head, and expect WordPress to 
 * provide it for us. 
add_theme_support( 'title-tag' );

Remove Markup and title in templates, like single.php

<title><?php wp_title( '|', true, 'right' ); ?></title>

Backwards compatibility

To enable support in existing themes without breaking backwards compatibility, theme authors can check if the callback function exists, and add a shiv in case it does not:

if ( ! function_exists( '_wp_render_title_tag' ) ) :
function theme_slug_render_title() {
    echo '<title>' . wp_title( '|', false, 'right' ) . "</title>\n";
add_action( 'wp_head', 'theme_slug_render_title' );

This would also be the place to optionally add a filter to enhance the document title, along the lines of what recent default themes have been doing.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant