我的WordPress帖子循环失败
我用这个代码在我的主页上每隔3篇帖子发布一则广告,但不是广告出现在第一篇帖子的后面,它似乎根本无法识别循环我的WordPress帖子循环失败,wordpress,loops,if-statement,while-loop,adsense,Wordpress,Loops,If Statement,While Loop,Adsense,我用这个代码在我的主页上每隔3篇帖子发布一则广告,但不是广告出现在第一篇帖子的后面,它似乎根本无法识别循环 <div id="mason-layout" class="transitions-enabled fluid"> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content',
<div id="mason-layout" class="transitions-enabled fluid">
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'blog' ); ?>
<?php if ($i == 3) { ?> ADHERE <?php } ?>
<?php $i++; ?>
<?php endwhile; ?>
遵守
有什么想法吗?
谢谢您错过了循环的一部分
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
推荐阅读:对不起,代码上面也有这两行,我知道,我复制粘贴错误,遗漏了两行
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// Post Content here
//
} // end while
} // end if