[Resolved] Add a Page Number to Category Pages

Home Forums Support [Resolved] Add a Page Number to Category Pages

Home Forums Support Add a Page Number to Category Pages

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1514124
    David

    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

    #1514372
    David
    Staff
    Customer Support

    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);
    #1515207
    David

    Thank you, that works perfectly.

    Best Regards
    David

    #1515210
    David

    Thank you.

    #1515231
    David
    Staff
    Customer Support

    You’re welcome

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.