Skip to content

Instantly share code, notes, and snippets.

@avillegasn
Created August 21, 2018 08:11
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 avillegasn/7414467807058172dd9ec37dbb2343dd to your computer and use it in GitHub Desktop.
Save avillegasn/7414467807058172dd9ec37dbb2343dd to your computer and use it in GitHub Desktop.
<?php
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Recipes', 'Post Type General Name', 'nelio' ),
'singular_name' => _x( 'Recipe', 'Post Type Singular Name', 'nelio' ),
'menu_name' => __( 'Recipes', 'nelio' ),
'name_admin_bar' => __( 'Recipe', 'nelio' ),
'archives' => __( 'Item Archives', 'nelio' ),
'attributes' => __( 'Item Attributes', 'nelio' ),
'parent_item_colon' => __( 'Parent Item:', 'nelio' ),
'all_items' => __( 'All Items', 'nelio' ),
'add_new_item' => __( 'Add New Item', 'nelio' ),
'add_new' => __( 'Add New', 'nelio' ),
'new_item' => __( 'New Item', 'nelio' ),
'edit_item' => __( 'Edit Item', 'nelio' ),
'update_item' => __( 'Update Item', 'nelio' ),
'view_item' => __( 'View Item', 'nelio' ),
'view_items' => __( 'View Items', 'nelio' ),
'search_items' => __( 'Search Item', 'nelio' ),
'not_found' => __( 'Not found', 'nelio' ),
'not_found_in_trash' => __( 'Not found in Trash', 'nelio' ),
'featured_image' => __( 'Featured Image', 'nelio' ),
'set_featured_image' => __( 'Set featured image', 'nelio' ),
'remove_featured_image' => __( 'Remove featured image', 'nelio' ),
'use_featured_image' => __( 'Use as featured image', 'nelio' ),
'insert_into_item' => __( 'Insert into item', 'nelio' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'nelio' ),
'items_list' => __( 'Items list', 'nelio' ),
'items_list_navigation' => __( 'Items list navigation', 'nelio' ),
'filter_items_list' => __( 'Filter items list', 'nelio' ),
);
$args = array(
'label' => __( 'Recipe', 'nelio' ),
'description' => __( 'Post Type Description', 'nelio' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'custom-fields' ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'recipe', $args );
}
add_action( 'init', 'custom_post_type', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment