直接在functions.php里加上
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// 去掉标题带#8211问题 function new_add_theme_support_title(){ add_theme_support( 'title-tag' ); } add_action( 'after_setup_theme', 'new_add_theme_support_title' ); function new_compat_render_title_tag(){ if( !function_exists( '_wp_render_title_tag' ) ) echo '<title>' . wp_title( '|', true, 'right' ) . '</title>'; } add_action( 'wp_head', 'new_compat_render_title_tag', 1 ); function new_title_separator_to_line(){ return '|';//change '-' separator to '|' } add_filter( 'document_title_separator', 'new_title_separator_to_line' ); |