slavapas
2/18/2019 - 7:19 PM

Register Post Type #Wordpress #Post Type

Register Post Type #Wordpress #Post Type

/**
 * Register a custom post type called "book".
 *
 * @see get_post_type_labels() for label keys.
 */
function intensiv_custom_post_type_gallery() {
    $labels = array(
        'name'              	=> _x( 'Galleries', 'Post type general name', textdomain' ),
        'singular_name'     	=> _x( 'Gallery', 'Post type singular name', 'textdomain' ),
      );

    $args = array(
        'labels'         	=> $labels,
        'public'         	=> true,
        'publicly_queryable' => true,
        'show_ui'        	=> true,
        'show_in_menu'   	=> true,
        'query_var'      	=> true,
        'rewrite'        	=> array( 'slug' => 'gallery' ),
        'capability_type'	=> 'post',
        'has_archive'    	=> true,
        'hierarchical'   	=> false,
        'menu_position'  	=> null,
        'supports'       	=> array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
    );

    register_post_type( 'gallery', $args );
}

add_action( 'init', 'intensiv_custom_post_type_gallery' );