简体   繁体   中英

How to show Wordpress page number and total number of pages (i.e., page 1 of 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM