Before i shared you a post about “show/break large post with pagination and to show Next Page and Previous page instead of pagination number” today i am sharing you another issue about large post where you split the post with pagination. Here i am showing you to show Page Number in Titles when u click on Next Page or Previous page and to show same page number in Site Title and in Meta description. This is needed due to SEO purpose. This snippet of code is for Advanced wordpress users, please use this code before taking backup.
This code will go in Single Post template
<?php the_title();if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s'), max( $paged, $page ) ). ""." of ".$page; ?>This code will go in function.php
if ( ! function_exists( 'add_page_number' ) ) { function add_page_number( $s ) { global $page; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; !empty ( $page ) && 1 < $page && $paged = $page; $paged > 1 && $s .= ' - ' . sprintf( __( 'Page %s' ), $paged ); return $s; } add_filter( 'wpseo_title', 'add_page_number', 100, 1 ); add_filter( 'wpseo_metadesc', 'add_page_number', 100, 1 ); }*** If you are not experienced enough to edit theme file please feel free to ask help in the comments section.
Or
You can take my personal help in skype : om2000_cuet
Hi, I’m trying to use this script to add the page number to the category/archive pages and for some reason it’s pulling in the title of the first post instead of the category title page #. Any ideas?
Thanks!
LikeLike
Hi Anthony
this post is to show the paginated posts… not the archive page actually
LikeLike