好的,听起来您需要使用query_posts()
, 但只在Site Front Page.
我认为二十点十分不包括front-page.php
模板文件,因此我们将修改index.php
直接地将以下代码添加到index.php
, 循环输出之前的任何位置:
<?php
// Determine if we\'re on the site Front Page
if ( is_front_page() ) {
// Globalize $wp_query
global $wp_query;
// Create argument array in which we
// exclude desired category IDs. Categories
// are listed as a comma-separated string.
// e.g. \'-3\', or \'-1,-2,-3\'
$exclude_cats = array( \'cat\' => \'-3\' );
// Merge custom arguments with default query args array
$custom_query_args = array_merge( $wp_query->query, $exclude_cats );
// Query posts using our modified argument array
query_posts( $custom_query_args );
} // is_front_page()
?>