我正在制作Twenty Ten主题子主题,我有一个页面没有显示我在functions.php页面上设置的一些自定义分类的帖子。但是我可以看到各个帖子,我只是无法让它们在页面上预览。
在预览页面上我正在使用以下内容来显示摘录帖子
<?php if ( is_page('photo-gallery') ) { query_posts( array( 'posts_per_page' => 9, 'cat' => '13,25,26,27,28,29,30,31,32', 'paged' => get_query_var('paged') ) ); } ?>
在functions.php页面上我有:
add_action('init', 'gallery_register');
function gallery_register() {
$labels = array(
'name' => _x('Photo Gallery', 'post type general name'),
'singular_name' => _x('Gallery Item', 'post type singular name'),
'add_new' => _x('Add New', 'gallery item'),
'add_new_item' => __('Add New Gallery Item'),
'edit_item' => __('Edit Gallery Item'),
'new_item' => __('New Gallery Item'),
'view_item' => __('View Gallery Item'),
'search_items' => __('Search Gallery'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail','comments','revisions','excerpt','page-attributes')
);
register_post_type( 'gallery' , $args );
}
register_taxonomy("photo_categories", array("gallery"), array("hierarchical" => true, "label" => "Photos Categories", "singular_label" => "Photo", "rewrite" => true));
这可能很简单但我看不出我做错了什么想法?