Site logo

Archived topic

Add a Page Number to Category Pages

4 replies · Started by David on November 2, 2020

Viewing posts 1–5 of 5

Hello,

Would you be able to advise how to a page number to the H1 Category Pages please.

One Category page 2 example is as follows:-

https://darkstories.com.au/category/australian-crime/page/2/

Australian Crime - Page 2

Your advice would be greatly appreciated please.

Many thanks
David

Hi there,

try this PHP Snippet:

function db_paginated_archive_title( $title ) {
    if ( is_category() ) {
        $current_page = max(1, get_query_var('paged'));
        $title = single_cat_title( '', false ) . '<span clas="archive-pagination"> Page ' . $current_page . '</span>';
    }  
    return $title;
}

add_filter( 'get_the_archive_title', 'db_paginated_archive_title', 50);

Thank you, that works perfectly.

Best Regards
David

Thank you.

You're welcome

This archived topic is closed to new replies.