Created
February 18, 2019 19:19
-
-
Save slavapas/0c4a84b5bbf8dfa290864c5ec24314d5 to your computer and use it in GitHub Desktop.
Register Post Type #Wordpress #Post Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment