【发布时间】:2016-12-27 09:12:55
【问题描述】:
所以我觉得我在做一些明显简单的事情,但不知道是什么! 我创建了我的自定义帖子类型 = Author 然后创建了 single-Author.php 来显示每个作者的信息但是当我打开每个作者的链接时 404.php
这里是自定义帖子类型作者
function p2p2_register_author(){
$labels = array(
'name' => _x( 'همکاران', 'Author' ),
'singular_name' => _x('همکار','Author'),
'add_new' => _x( 'افزودن همکار', '' ),
'add_new_item' => __( 'افزودن همکاران جدید' ),
'edit_item' => __( 'ویرایش همکار' ),
'new_item' => __( 'همکار جدید' ),
'all_items' => __( 'همه همکاران' ),
'search_items' => __( 'جست و جو همکار' ),
'not_found' => __( 'همکاری یافت نشد' ),
'not_found_in_trash' => __( 'همکار در زباله دان یافت نشد' ),
'parent_item_colon' => '',
'menu_name' => 'همکار'
);
register_post_type(
'Author',
array (
'labels' => $labels,
'description' => 'ذخیره اطلاعات مربوط به همکاران',
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'author' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
)
);
}
add_action('init', 'p2p2_register_author');
flush_rewrite_rules();
我也有存档作者,它工作得很好,但单作者.php 不起作用。
任何帮助将不胜感激!
【问题讨论】:
标签: php wordpress custom-post-type