在wordpress中显示单个type.php和archive-type.php文件的白色屏幕

时间:2014-01-10 09:54:18

标签: wordpress

我创建了自定义帖子类型'gallery'以在单页中显示名为single-gallery.php和archive-gallery.php的文件,但它为我提供了白屏 请帮我解决我的问题...这是我的代码..

// Register Custom Post Type

function gallery(){

$labels = array(
    'name'                => _x( 'gallery', 'Post Type General Name', 'text_domain' ),
    'singular_name'       => _x( 'gallery', 'Post Type Singular Name', 'text_domain' ),
    'menu_name'           => __( 'gallery', 'text_domain' ),
    'parent_item_colon'   => __( 'Parent gallery', 'text_domain' ),
    'all_items'           => __( 'All gallery', 'text_domain' ),
    'view_item'           => __( 'View gallery', 'text_domain' ),
    'add_new_item'        => __( 'Add New gallery', 'text_domain' ),
    'add_new'             => __( 'New gallery', 'text_domain' ),
    'edit_item'           => __( 'Edit gallery', 'text_domain' ),
    'update_item'         => __( 'Update gallery', 'text_domain' ),
    'search_items'        => __( 'Search gallerys', 'text_domain' ),
    'not_found'           => __( 'No gallerys found', 'text_domain' ),
    'not_found_in_trash'  => __( 'No gallerys found in Trash', 'text_domain' ),
);
$args = array(
    'label'               => __( 'gallery', 'text_domain' ),
    'description'         => __( 'gallery information pages', 'text_domain' ),
    'labels'              => $labels,
    'supports'            => array( 'title', 'editor', 'thumbnail', 'comments', 'custom-fields', ),
    'taxonomies'          => array( 'category', 'post_tag' ),
    'hierarchical'        => false,
    'public'              => true,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'show_in_nav_menus'   => true,
    'show_in_admin_bar'   => true,
    'menu_position'       => 5,
    'menu_icon'           => '',
    'can_export'          => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'publicly_queryable'  => true,
    'capability_type'     => 'page',
);
register_post_type( 'gallery', $args );

}

//加入'init'动作 add_action('init','gallery',0);

1 个答案:

答案 0 :(得分:0)

有时只是访问wordpress管理员中的固定链接设置可以解决此类问题。你试过吗?