Skip to content

Instantly share code, notes, and snippets.

@rgadon107
Last active February 4, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgadon107/4034bef894e187dcf73f73799d4776bd to your computer and use it in GitHub Desktop.
Save rgadon107/4034bef894e187dcf73f73799d4776bd to your computer and use it in GitHub Desktop.
Custom Post Type functionality generated for 'Tours' custom post type plugin.
<?php
/**
* Custom Post Type functionality
*
* @package spiralWebDb\JourneysWithJeffHoag
* @since 1.0.0
* @author Robert A Gadon
* @link https://spiralwebdb.com
* @license GNU General Public License 2.0+
*/
namespace spiralWebDb\JourneysWithJeffHoag\Tours\Custom;
add_action( 'init', __NAMESPACE__ . '\register_custom_post_type' );
/**
* Register the custom post type.
*
* @since 1.0.0
*
* @return void
*/
function register_custom_post_type() {
$labels = array(
'singular_name' => _x( 'Tour', 'post type singular name', 'jwj-tours' ),
'name_admin_bar' => _x( 'Tour', 'add new on admin bar', 'jwj-tours' ),
'add_new' => _x( 'Add New', 'tours', 'jwj-tours' ),
'add_new_item' => __( 'Add New Tour', 'jwj-tours' ),
'new_item' => __( 'New Tour', 'jwj-tours' ),
'edit_item' => __( 'Edit Tour', 'jwj-tours' ),
'view_item' => __( 'View Tour', 'jwj-tours' ),
'view_items' => __( 'View Tours', 'jwj-tours' ),
'all_items' => __( 'All Tours', 'jwj-tours' ),
'search_items' => __( 'Search Tours', 'jwj-tours' ),
'parent_item_colon' => __( 'Parent Tours:', 'jwj-tours' ),
'not_found' => __( 'No tours found.', 'jwj-tours' ),
'not_found_in_trash' => __( 'No tours found in Trash.', 'jwj-tours' ),
'featured_image' => __( 'Featured Tour Image', 'jwj-tours' ),
'set_featured_image' => __( 'Set Tour Image', 'jwj-tours' ),
'remove_featured_image' => __( 'Remove Tour Image', 'jwj-tours' ),
'use_featured_image' => __( 'Use Tour Image', 'jwj-tours' ),
);
$args = array(
'description' => __( 'A list of scheduled custom tours.', 'jwj-tours' ),
'label' => __( 'Tours', 'jwj-tours' ),
'labels' => $labels,
'public' => true,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'page-attributes' ),
'show_in_menu' => true,
'menu position' => 10,
'menu_icon' => 'dashicons-palmtree',
'has_archive' => true,
'rewrite' => true,
);
register_post_type( 'tours', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment