【发布时间】:2014-04-08 10:37:52
【问题描述】:
我在 Wordpress 中遇到了循环问题 - 正在添加代码并在循环中重复...
这是代码:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php get_template_part( 'partials/loop', 'page' ); ?>
<?php $the_query = new WP_Query( 'showposts=3' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<?php the_post_thumbnail( array(100,100) );?>
<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
<?php echo strip_tags(get_the_excerpt()) ?>
<?php endwhile; else : ?>
<?php get_template_part( 'partials/content', 'missing' ); ?>
<?php endif; ?>
输出:
<img width="100" height="100" src="http://blahblah/glasses-150x150.png" class="attachment-100x100 wp-post-image" alt="glasses">
<h4><a href="http://blahblah/titleofpost/">Title of Post</a></h4>
The Excerpt of the post, blah blah blah Read more »
 
我不知道在哪里 最后的代码来自 - 任何帮助表示赞赏:)
来自
【问题讨论】:
-
您是否有任何插件试图将内容添加到帖子底部?看起来这可能是一个插件问题。尝试将它们全部禁用,看看它是否会消失。
标签: php wordpress loops while-loop