Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wpseo_title', 'td_wpseo_title', 10, 1);
- function td_wpseo_title($seo_title) {
- // outside the loop, it's reliable to check the page template
- if (!in_the_loop() && is_page_template('page-pagebuilder-latest.php')) {
- $td_page = (get_query_var('page')) ? get_query_var('page') : 1; //rewrite the global var
- $td_paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //rewrite the global var
- if ($td_paged > $td_page) {
- $local_paged = $td_paged;
- } else {
- $local_paged = $td_page;
- }
- // the custom title is when the pagination is greater than 1
- if ($local_paged > 1) {
- $post_id = get_queried_object_id();
- return td_wp_title(get_the_title($post_id), ' - ');
- }
- }
- // otherwise, the param $seo_title is returned as it is
- return $seo_title;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement