Skip to content

Instantly share code, notes, and snippets.

@mustardBees
Created August 27, 2013 16:30
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 mustardBees/6355845 to your computer and use it in GitHub Desktop.
Save mustardBees/6355845 to your computer and use it in GitHub Desktop.
Register a store post type in WordPress
<?php
/**
* Create store post type
*
* @author Phil Wylie
* @link http://goo.gl/bjc6XV
*/
function pw_register_store_post_type() {
$labels = array(
'name' => 'Stores',
'singular_name' => 'Store',
'add_new' => 'Add New',
'add_new_item' => 'Add New Store',
'edit_item' => 'Edit Store',
'new_item' => 'New Store',
'view_item' => 'View Store',
'search_items' => 'Search Stores',
'not_found' => 'No stores found',
'not_found_in_trash' => 'No stores found in Trash',
'parent_item_colon' => 'Parent Store:',
'menu_name' => 'Stores'
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'title' ),
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'publicly_queryable' => false,
'exclude_from_search' => true,
'has_archive' => false,
'query_var' => false,
'can_export' => true,
'rewrite' => false,
'capability_type' => 'post'
);
register_post_type( 'store', $args );
}
add_action( 'init', 'pw_register_store_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment