【发布时间】:2019-03-11 11:29:56
【问题描述】:
我是 wordpress 领域的新手,我正在尝试将 HTML 页面调整为 wordpress 主题。 我需要首先在页面上显示页面内容,然后在该页面下显示帖子。但我得到的只是在页面上显示两次的帖子(页面内容应该在哪里)。有没有可能克服这个问题?
还有一个问题,如何根据帖子类别过滤帖子?我试过query_posts('cat=Small'),但它似乎不能正常工作。
index.php 的代码如下:
<?php get_header(); ?>
<?php
wp_reset_query();
while ( have_posts() ) : the_post();
the_content();
endwhile;
wp_reset_query();
?>
<section>
<header class="major">
<h2>Erat lacinia</h2>
</header>
<div class="features">
<?php query_posts('cat=Small'); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<article>
<span class="icon fa-diamond"></span>
<div class="content">
<h3><?php the_title(); ?></h3>
<p><?php the_content('Read More'); ?></p>
</div>
</article>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>
【问题讨论】:
标签: php wordpress wordpress-theming custom-wordpress-pages