1
我在創建新的WordPress主題時遇到了一個奇怪的問題。所以也許因爲我一整天都在這裏,但需要看看是否有人能夠發現我的錯誤,或者看看有什麼問題。WordPress的自定義帖子沒有顯示特色
我想根據類別的名稱顯示'精選'的帖子,只顯示一個,如果這已在wp-admin部分檢查。然而,我在代碼中定義了這一點,但它顯示了最新的帖子,而不管它是否被顯示。
<?php
$args = array(
'post_type' => 'post',
'category_mame' => 'featured',
'posts_per_page' => 1
);
$the_query = new WP_Query($args);
?>
<?php if (have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="push_2 grid_10 omega clearfix">
<article>
<?php get_template_part('content', 'post'); ?>
</article>
</div>
<?php endwhile; endif; ?>
</div>
噢,我的,這是非常尷尬的,錯字是問題('mame')。但也感謝您的額外信息。 – Dan 2014-11-06 15:44:51
@丹我很高興聽到它現在正在工作 – pbaldauf 2014-11-06 15:49:01