Last active
October 2, 2019 18:14
-
-
Save Galibri/456cf17016fe569c3c58109ac47141f8 to your computer and use it in GitHub Desktop.
Register Custom Post Type (Repo)
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 | |
add_action( 'init', 'bs_create_github_post_type' ); | |
/** | |
* Register a repo post type. | |
* | |
* @link http://codex.wordpress.org/Function_Reference/register_post_type | |
*/ | |
function bs_create_github_post_type() { | |
$labels = array( | |
'name' => __( 'Repos', 'text-domain' ), | |
'singular_name' => __( 'Repo', 'text-domain' ), | |
'menu_name' => __( 'Repos', 'text-domain' ), | |
'name_admin_bar' => __( 'Repo', 'text-domain' ), | |
'add_new' => __( 'Add New', 'repo', 'text-domain' ), | |
'add_new_item' => __( 'Add New Repo', 'text-domain' ), | |
'new_item' => __( 'New Repo', 'text-domain' ), | |
'edit_item' => __( 'Edit Repo', 'text-domain' ), | |
'view_item' => __( 'View Repo', 'text-domain' ), | |
'all_items' => __( 'All Repos', 'text-domain' ), | |
'search_items' => __( 'Search Repos', 'text-domain' ), | |
'parent_item_colon' => __( 'Parent Repos:', 'text-domain' ), | |
'not_found' => __( 'No repos found.', 'text-domain' ), | |
'not_found_in_trash' => __( 'No repos found in Trash.', 'text-domain' ) | |
); | |
$args = array( | |
'labels' => $labels, | |
'description' => __( 'Description.', 'text-domain' ), | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'repo' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => array( 'title', 'editor' ) | |
); | |
register_post_type( 'repo', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment