Created
November 15, 2014 03:13
-
-
Save lgedeon/9264d1955fac3bc73fd9 to your computer and use it in GitHub Desktop.
Custom Post Type Template
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 | |
namespace My\Name\Space; | |
function action__init() { | |
$namespace = "translation-namespace"; | |
$single = __( 'Custom Post Type', $namespace ); | |
$plural = __( 'Custom Post Types', $namespace ); | |
register_post_type( 'namespace_custom_post_type', | |
array( | |
'labels' => array( | |
'name' => $plural, | |
'singular_name' => $single, | |
'menu_name' => $plural, | |
'name_admin_bar' => $single, | |
'add_new' => __( 'Add New', $namespace ), | |
'add_new_item' => sprintf( __( 'Add New %s', $namespace ), $single ), | |
'new_item' => sprintf( __( 'New %s', $namespace ), $single ), | |
'edit_item' => sprintf( __( 'Edit %s', $namespace ), $single ), | |
'view_item' => sprintf( __( 'View %s', $namespace ), $single ), | |
'all_items' => sprintf( __( 'All %s', $namespace ), $plural ), | |
'search_items' => sprintf( __( 'Search %s', $namespace ), $plural ), | |
'parent_item_colon' => sprintf( __( 'Parent %s:', $namespace ), $plural ), | |
'not_found' => sprintf( __( 'No %s found', $namespace ), $plural ), | |
'not_found_in_trash' => sprintf( __( 'No %s found in trash', $namespace ), $plural ), | |
), | |
'hierarchical' => false, | |
'supports' => array( 'title', 'editor', 'thumbnail' ), | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'show_in_nav_menus' => true, | |
'publicly_queryable' => true, | |
'exclude_from_search' => false, | |
'has_archive' => true, | |
'query_var' => true, | |
'can_export' => true, | |
'rewrite' => array( 'slug' => sanitize_key( str_replace( ' ', '_', $single ) ) ), | |
'capability_type' => 'post', | |
) | |
); | |
} | |
add_action( 'init', __NAMESPACE__ . '\action__init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment