如何显示Wordpress页码和总页数(即第1页,共3页)

I would like to display the page numbers in index.php, search.php and archive.php

As far as I'm aware, the variable $page contains the current page number, this works, but I just need the number of pages.

Also is there an easy way to get the URL for the next page and previous page for use any way you wish? next_posts_link(); and previous_posts_link(); don't seem to be able to do what I want.

Thanks.

You can use (or look at the source of) this plugin:

WordPress > WP Page Numbers

I agree that there should be something similar to the $page variable. But if it's not in the WP codex, you could dive into the wonderful world of Custom Queries .

As far as I'm aware, the variable $page contains the current page number, this works, but I just need the number of pages.

I know that you have to count the record in global $paged