我正在试图找出如何在wordpress循环中仅显示某些元素的自定义循环。
我的循环目前包含标题,创作日期,作者和作品。内容。
但是我正在尝试删除循环中每个帖子的内容,因为我不希望它显示在此列表中而没有运气。我甚至将the_content()移出了循环和放大器它仍然显示循环部分下的帖子内容列表。
非常感谢任何帮助,
这是我的代码:
<?php query_posts('category_name=halloween &posts_per_page=6'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- IF articles then display them -->
<h6><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h6>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<?php endwhile; else: ?>
<!-- IF no articles were created then show -->
NO Posts Present
<?php endif; ?>
答案 0 :(得分:0)
我似乎找到了我的代码中缺少的内容,因为我需要在循环结束时需要以下代码片段来修复问题:
这是我在endif
之后添加的代码<?php wp_reset_query(); ?>