WordPress开发

wordpress自定义文章类型

function my_custom_init()    
{   
    $labels = array(   
        'name' => '动态',   
        'singular_name' => '动态',   
        'add_new' => '添加一条新动态',   
        'add_new_item' => '添加一条新动态',   
        'edit_item' => '编辑动态',   
        'new_item' => '新动态', 
        'all_items'=>'所有动态',     
        'view_item' => '查看动态',   
        'search_items' => '搜索动态',   
        'not_found' =>  '没有动态',   
        'not_found_in_trash' => '回收站中没有动态',    
        'parent_item_colon' => '',   
        'menu_name' => '动态'   
    );   
    $args = array(   
        'labels' => $labels,   
        'public' => true,   
        'publicly_queryable' => true,   
        'show_ui' => true,
        'exclude_from_search' =>false,    
        'show_in_menu' => true,    
        'query_var' => true,   
        'rewrite' => true,   
        'capability_type' => 'post',   
        'has_archive' => true,    
        'hierarchical' => false,   
        'menu_position' => null,   
        'supports' => array('editor','author')   
    );    
    register_post_type('dynamic',$args);   
}
add_action('init', 'my_custom_init');

发表评论

插入图片