开发者

(Wordpress) Global variable to detect pagination?

开发者 https://www.devze.com 2022-12-27 20:48 出处:网络
I am showing 6 posts on one page. On the 7th post, pagination occurs on so on. goal: If there is more than one page (page 1, 2, 3, etc..), JavaScript is to add a specific div element. If there are on

I am showing 6 posts on one page. On the 7th post, pagination occurs on so on.

goal: If there is more than one page (page 1, 2, 3, etc..), JavaScript is to add a specific div element. If there are only 6 posts or less, no pagination occurs, no 开发者_JAVA百科div element is added.

The number of posts to show:

$showposts = get_query_var('showposts');

The current post number I can keep track of:

    $post_count++;

Problem is I can keep track of posts 1-6 but how to tell if if it goes over to 7 and starts pagination? I thought there was a global variable that returns if pagination occurs, but I can't seem to find it.

(I know there is global to detect pagination via <!--nextpage--> but so far I can't find it's equivalent for index.php).


$paged is a global var that is set to the page number WP is displaying.

0

精彩评论

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