Wordpress注册自定义post类型
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress注册自定义post类型相关的知识,希望对你有一定的参考价值。
// creating (registering) the custom type 'name' => _x('Custom Types', 'post type general name', 'big_bang'), //This is the title of the group 'singular_name' => _x('Custom Post', 'post type singular name', 'big_bang'), //This is the individual type 'add_new' => _x('Add New', 'custom post type item', 'big_bang'), //The add new menu item 'add_new_item' => __('Add New Custom Type', 'big_bang'), // Add new Display Title 'all_items' => __('All Custom Types', 'big_bang'), // The All Items in the Menu 'edit' => __('Edit', 'big_bang'), //Edit Dialog 'edit_item' => __('Edit Custom Type', 'big_bang'), //Edit Display Title 'new_item' => __('New Custom Type', 'big_bang'), //New Display Title 'view_item' => __('View Custom Type', 'big_bang'), //View Display Title 'search_items' => __('Search Custom Post Type', 'big_bang'), //Search Custom Type Title 'not_found' => __('Nothing found in the Database.', 'big_bang'), //This displays if there are no entries yet 'not_found_in_trash'=> __('Nothing found in Trash', 'big_bang'), //This displays if there is nothing in the trash 'parent_item_colon' => '' ); 'labels' => $labels, 'description' => __('This is an example custom post type.', 'big_bang'), //Custom Type Description 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'query_var' => true, 'menu_position' => 8, //This is what order you want it to appear in on the left hand side menu 'menu_icon' => get_stylesheet_directory_uri() . '/images/custom-post-icon.png', //the icon for the custom post type menu 'rewrite' => true, 'capability_type' => 'post', 'hierachical' => false, // the next one is important, it tells what's enabled in the post editor 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky') ); register_post_type( 'custom_type', $args); // (http://codex.wordpress.org/Function_Reference/register_post_type)
以上是关于Wordpress注册自定义post类型的主要内容,如果未能解决你的问题,请参考以下文章