How to add a page number to each title and description
-
Hello! Tell me, please, how to add a page number to each title and description in an article with a pangination? In the Yoast plugin for this purpose I used this function:
/** Add Page Number to Title and Meta Description for SEO **/ if ( ! function_exists( 'multipage_metadesc' ) ){ function multipage_metadesc( $s ){ global $page; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ! empty ( $page ) && 1 < $page && $paged = $page; $paged > 1 && $s .= ' - ' . sprintf( __( 'Part %s', 'theme' ), $paged ); return $s; } add_filter( 'wpseo_metadesc', 'multipage_metadesc', 100, 1 ); } if ( ! function_exists( 'multipage_title' ) ){ function multipage_title( $title ){ global $page; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ! empty ( $page ) && 1 < $page && $paged = $page; $paged > 1 && $title .= ' - ' . sprintf( __( 'Part %s', 'theme' ), $paged ); return $title; } add_filter( 'wpseo_title', 'multipage_title', 100, 1 ); }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to add a page number to each title and description’ is closed to new replies.