Thank you.
I am using Avada theme. I put %%page%%
in a costum page title AND description. I am running an online shop and have a product catalogue on my starting page. That’s why I need pagination there.
Didn’t check with 2021. Will try that.
Meanwhile I found an interesting workaround by using the following plugin code and added a filter for the open graph description (og:description
). That combined with your variable %%page%%
in title did the trick. (Just if anyone else having the same issue and does a search on this I’ll post it below.)
I now have what I want:
– meta description with “(…)| Page: x”
– title with “(…)| Page x from y”
– og:description with “(…)| Page: x”
– og:title with “(…)| Page x from y”
The plugin code (simply generate folder with plugin name and copy the following code as php file into that newly created folder):
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Add page number to title
* Description: Adds <code> | Page $number</code> to the page title.
* License: MIT
* License URI: https://www.opensource.org/licenses/mit-license.php
*/
if ( ! function_exists( 't5_add_page_number' ) )
{
function t5_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( __( 'Seite: %s' ), $paged );
return $s;
}
add_filter( 'wp_title', 't5_add_page_number', 100, 1 );
add_filter( 'wpseo_metadesc', 't5_add_page_number', 100, 1 );
add_filter( 'wpseo_opengraph_desc', 't5_add_page_number', 100, 1);
}
add_filter( 'wp_title', 't5_add_page_number', 100, 1 );
adresses the og:title
add_filter( 'wpseo_metadesc', 't5_add_page_number', 100, 1 );
adresses the meta description
add_filter( 'wpseo_opengraph_desc', 't5_add_page_number', 100, 1);
adresses the og:descripton