Php 在第页最后一篇文章之前插入div

Php 在第页最后一篇文章之前插入div,php,wordpress,loops,Php,Wordpress,Loops,我想在循环页面上最后返回的帖子之前插入一个div。我每页显示10篇文章,很容易做到 <?php if ($counter === 9).... 作者:| 这行吗 <php? if (($the_query->current_post +1) == (($the_query->postcount)-1))... current\u post+1)=(($the\u query->postcount)-1))。。。 或者首先设置一个变量来检查是否等于第二个值。这是否

我想在循环页面上最后返回的帖子之前插入一个div。我每页显示10篇文章,很容易做到

<?php if ($counter === 9)....

作者:|

这行吗

<php? if (($the_query->current_post +1) == (($the_query->postcount)-1))...
current\u post+1)=(($the\u query->postcount)-1))。。。
或者首先设置一个变量来检查是否等于第二个值。

这是否可行

<php? if (($the_query->current_post +1) == (($the_query->postcount)-1))...
current\u post+1)=(($the\u query->postcount)-1))。。。

或者首先设置一个变量来检查是否等于第二个值。

$found\u posts变量将返回您拥有的帖子总数

将$found\u posts减去1,然后与$the\u query->current\u post进行比较

例如:

if (($the_query->current_post) == ($the_query->found_posts - 1)){
// Insert div.
}

$found\u posts变量将返回您拥有的帖子总数

将$found\u posts减去1,然后与$the\u query->current\u post进行比较

例如:

if (($the_query->current_post) == ($the_query->found_posts - 1)){
// Insert div.
}

多亏了@Loai,他让我走上了正轨

<?php if (($the_query->current_post +1) == ($the_query->post_count -1))

多亏了@Loai,他让我走上了正轨

<?php if (($the_query->current_post +1) == ($the_query->post_count -1))

分享你是如何构建每页显示10篇文章的分享你是如何构建每页显示10篇文章的分享让我走上正轨的,谢谢。让我走上正轨,谢谢。