• 1.
    //Add page number to Yoast meta description and page titles to avoid duplication (when using customised titles/descriptions)
  • 2.
    if ( ! function_exists( 'cvw_add_page_number' ) )
  • 3.
    {
  • 4.
        function cvw_add_page_number( $s )
  • 5.
        {
  • 6.
            global $page;
  • 7.
            $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
  • 8.
            ! empty ( $page ) && 1 < $page && $paged = $page;
  • 9.
            $paged > 1 && $s .= ' - ' . sprintf( __( 'Page %s' ), $paged );
  • 10.
            return $s;
  • 11.
        }
  • 12.
        
  • 13.
        add_filter( 'wpseo_metadesc', 'cvw_add_page_number', 100, 1 );
  • 14.
        add_filter( 'wpseo_title', 'cvw_add_page_number', 100, 1 );
  • 15.
    }
//Add page number to Yoast meta description and page titles to avoid duplication (when using customised titles/descriptions) if ( ! function_exists( 'cvw_add_page_number' ) ) { function cvw_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_metadesc', 'cvw_add_page_number', 100, 1 ); add_filter( 'wpseo_title', 'cvw_add_page_number', 100, 1 ); }

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter