开发者

How to show Wordpress page number and total number of pages (i.e., page 1 of 3)

开发者 https://www.devze.com 2022-12-08 21:54 出处:网络
I would like to display the page numb开发者_JS百科ers 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 t

I would like to display the page numb开发者_JS百科ers 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

0

精彩评论

暂无评论...
验证码 换一张
取 消