Wordpress自定义Post类型注册
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress自定义Post类型注册相关的知识,希望对你有一定的参考价值。
Code for the wordpress functions file to add a custom post type.Full doc at:
http://codex.wordpress.org/Function_Reference/register_post_type
http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress
add_action('init', 'my_custom_init'); function my_custom_init() { 'name' => _x('Books', 'post type general name'), 'singular_name' => _x('Book', 'post type singular name'), 'add_new' => _x('Add New', 'book'), 'add_new_item' => __('Add New Book'), 'edit_item' => __('Edit Book'), 'new_item' => __('New Book'), 'view_item' => __('View Book'), 'search_items' => __('Search Books'), 'not_found' => __('No books found'), 'not_found_in_trash' => __('No books found in Trash'), 'parent_item_colon' => '' ); 'labels' => $labels, 'public' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, ); register_post_type('book',$args); }
以上是关于Wordpress自定义Post类型注册的主要内容,如果未能解决你的问题,请参考以下文章