How to add page number to blog title in WordPress
Many friends will optimize the website to prevent duplicate content. Add page numbers when paginating articles or lists to prevent duplicate titles from appearing. Let’s introduce to you how to add page numbers to the blog title in WordPress.
1. Open header.php. This is before modification. The code is as follows:
if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
2. The modified code is as follows:
if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( '第 %s 页', 'twentyten' ), max( $paged, $page ) );
3. Everyone's theme may be different. In fact, you only need to change 'Page %s' to 'Page %s'. If you don't know how to program, we can Add the following code to the template page:
<?php $paged = get_query_var('paged'); if ( $paged > 1 ) printf(' – 第 %s 页 ',$paged); ?>
Recommended tutorial: WordPress Tutorial
The above is the detailed content of How to add page number to blog title in WordPress. For more information, please follow other related articles on the PHP Chinese website!