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

如何显示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.

我想在index.php,search.php和archive.php中显示页码 p>

据我所知,变量$ page包含当前页码,这是有效的,但我只需要页数。 p>

也是 有一种简单的方法来获取下一页和上一页的URL以便以任何方式使用吗? next_posts_link(); 和previous_posts_link(); 似乎无法做我想做的事。 p>

谢谢。 p> div>

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