如何按新闻类别显示 post 个姓名
How to display post names by News category
我想按新闻类别显示 post 个姓名。我正在使用以下代码但无法正常工作
<?php
query_posts(array('&category_name=News&showposts=5'));
while (have_posts()) : the_post();
the_title();
endwhile;
?>
试试这个。
<?php
$args = array('cat' => 5); //pass news category Id.
// The Query
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
// Reset Query
wp_reset_query();
?>
我想按新闻类别显示 post 个姓名。我正在使用以下代码但无法正常工作
<?php
query_posts(array('&category_name=News&showposts=5'));
while (have_posts()) : the_post();
the_title();
endwhile;
?>
试试这个。
<?php
$args = array('cat' => 5); //pass news category Id.
// The Query
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
// Reset Query
wp_reset_query();
?>