您需要查询它们:(有关更多信息,请参阅内联注释)
/**
* Template Name: Journal
*/
// define( \'TEXTDOMAIN\', \'your_textdomain_string\' );
// To be sure, we reset the query, so nothing get\'s lost
wp_reset_query();
global $wp_query;
$query_cat = new WP_Query( array(
\'orderby\' => \'date comment_count\' // date = default, 2nd param = comment_count
,\'order\' => \'ASC\'
,\'post_type\' => \'post\'
,\'post_status\' => \'publish\'
,\'category_name\'=> \'slug_of_cat\' // change value here
) );
if ( $query_cat->have_posts() ) :
while ( $query_cat->have_posts() ) : $query_cat->the_post();
// check for password
if ( post_password_required() ) :
the_content();
elseif ( current_user_can(\'manage_options\') ) : // see codex roles & caps for more info
// display some decent message here if restricting accessability to the post
// or place something like
echo \'<span class="whatever">\'.sprintf(__(You can %1$s this page), TEXTDOMAIN), edit_post_link( __(\'edit\', TEXTDOMAIN), \' \', \')\', $post_id ).\'</span>\';
return;
else :
// here goes your content
endif;
endwhile;
else : // else; no posts
_e( \'Nothing published so far.\', TEXTDOMAIN );
endif; // endif; have_posts();
wp_rewind_posts(); // for a sec. query