您可以使用wp_title
用于修改wp_title
作用
基于Codex示例的快速示例:
add_filter( \'wp_title\', \'wpa66574_title_filter\', 10, 3 );
function wpa66574_title_filter( $title, $sep, $seplocation ) {
// account for $seplocation
$left_sep = ( $seplocation != \'right\' ? \' \' . $sep . \' \' : \'\' );
$right_sep = ( $seplocation != \'right\' ? \'\' : \' \' . $sep . \' \' );
$page_type = \'\';
// get special page type (if any)
if( is_category( \'videos\' ) ) $page_type = $left_sep . \'Archive\' . $right_sep;
// get the page number
if( get_query_var( \'paged\' ) ) $page_num = $left_sep. get_query_var( \'paged\' ) . $right_sep; // on index
elseif( get_query_var( \'page\' ) ) $page_num = $left_sep . get_query_var( \'page\' ) . $right_sep; // on single
else $page_num = \'\';
// concoct and return title
return $page_type . $title . $page_num;
}