The way I understand this, you’re trying to filter wp_title
to include your pagination data.
You can change the format in the sprintf
first parameter and other params as per your needs. Please use with caution.
add_filter('wp_title', function( $title ) {
global $paged // page number
, $wp_query; // WordPress query data
if( ! is_feed() && (int) $wp_query->max_num_pages > 1 ) {
$title = sprintf(
"%s - %d/%d - %s", // format
get_bloginfo('name'), // blog name
(int) $paged > 0 ? $paged : 1, // current page (goes 0 if no param set)
$wp_query->max_num_pages, // max number of pages found
get_bloginfo('description') // blog description
);
}
return $title;
}, 999);
Hope that helps.