-
-
Save Brandonsmith23/a3ba6450fbc8c217a67e277b446d68c6 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Gallery custom post type | |
*/ | |
function register_custom_post_type() { | |
$labels = [ | |
'name' => 'Galleries', | |
'singular_name' => 'Gallery', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New Gallery', | |
'edit_item' => 'Edit Gallery', | |
'new_item' => 'New Gallery', | |
'view_item' => 'View Gallery', | |
'search_items' => 'Search Galleries', | |
'not_found' => 'No Galleries found', | |
'not_found_in_trash' => 'No Galleries found in trash', | |
'parent_item_colon' => '', | |
'menu_name' => 'Galleries' | |
]; | |
$args = [ | |
'labels' => $labels, | |
'public' => true, | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_icon' => 'dashicons-images-alt2', | |
'query_var' => true, | |
'rewrite' => ['slug' => 'gallery'], | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'taxonomies' => array( 'category' ), | |
'supports' => ['title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields'] | |
]; | |
register_post_type('gallery', $args); | |
} | |
add_action('init', __NAMESPACE__ . '\\register_custom_post_type'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment