I am currently using this code to display the name of the post/page and of the blog in my wordpress theme:
<title><?php wp_title(''); ?> | <?php bloginfo('name'); ?></title>
The problem is that the of the index.php looks like this: | name of the blog
How can I fix this?
Thanks in advance!
In your functions.php
add
add_theme_support( 'title-tag' );
And in your header under your Content-Type
meta add, like this:
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<?php
if ( ! function_exists( '_wp_render_title_tag' ) ) :
function yourtheme_render_title() {
?>
<title><?php wp_title( ' ', true, 'right' ); ?></title>
<?php
}
add_action( 'wp_head', 'yourtheme_render_title' );
endif;
?>
Should be working once you set the title of your blog/web page on the Settings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.