wordpress API

wordpress的内容类型 post types, register_post_type(自定义内容类型)

日期:2014-10-04 阅读:2586

dmandwp系统 - wordpress系统和DM系统区块建站>>

http://codex.wordpress.org/Function_Reference/query_posts 

--------------------------

There are five post types that are readily available to users or internally used by the WordPress installation by default :

在wordpress的内容类型里,默认的有以下五个。

Post (Post Type: 'post')
Page (Post Type: 'page')
Attachment (Post Type: 'attachment')
Revision (Post Type: 'revision')
Navigation menu (Post Type: 'nav_menu_item')

---------------------------

Here's a basic example of adding a custom post type:

可以自定义内容类型:

add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'acme_product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}

 

-------------------

<<点击返回