Ali Vojdanian
Ali Vojdanian

Reputation: 2111

page number in category

I have a function which named kriesi_pagination this is a function for showing page numbers in php. I wrote the codes in function.php for my site. And I call this function in index.php for showing the page numbers in index. I use this code in index : <?php kriesi_pagination(); ?>

Now the question is what should I do if I want to show the page numbers in other places such as category. It just show the page numbers in home page of site not any other places.

I want to have page numbers for the categories like sports, musics, technology, .....

By the way I use wordpress cms for my website.

Please help me to solve this problem

Thanks in advance

Upvotes: 0

Views: 147

Answers (1)

doublesharp
doublesharp

Reputation: 27599

You should be able to use the query var value for paged to get the current page number:

function echo_page_number(){
    $page_number = isset($wp_query->query_vars["paged"])?
        $wp_query->query_vars["paged"] : // page number
        1; // not set, default to 1
    echo $page_number;
}

Upvotes: 1

Related Questions