Skip to content

Instantly share code, notes, and snippets.

@gpspake
Last active August 29, 2015 14:10
Show Gist options
  • Save gpspake/9ec427d977d1ec03dd3a to your computer and use it in GitHub Desktop.
Save gpspake/9ec427d977d1ec03dd3a to your computer and use it in GitHub Desktop.
vendors
if ( ! function_exists('vendor_custom_post_type') ) {
// Register Custom Post Type
function vendor_custom_post_type() {
$labels = array(
'name' => _x( 'Vendors', 'Post Type General Name', 'maryt' ),
'singular_name' => _x( 'Vendor', 'Post Type Singular Name', 'maryt' ),
'menu_name' => __( 'Vendor', 'maryt' ),
'parent_item_colon' => __( 'Parent Vendor:', 'maryt' ),
'all_items' => __( 'All Vendors', 'maryt' ),
'view_item' => __( 'View Vendor', 'maryt' ),
'add_new_item' => __( 'Add New Vendor', 'maryt' ),
'add_new' => __( 'Add New', 'maryt' ),
'edit_item' => __( 'Edit Vendor', 'maryt' ),
'update_item' => __( 'Update Vendor', 'maryt' ),
'search_items' => __( 'Search Vendor', 'maryt' ),
'not_found' => __( 'Not found', 'maryt' ),
'not_found_in_trash' => __( 'Not found in Trash', 'maryt' ),
);
$args = array(
'label' => __( 'vendors', 'maryt' ),
'description' => __( 'Vendors', 'maryt' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
'taxonomies' => array( 'vendor-type' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'vendors', $args );
}
// Hook into the 'init' action
add_action( 'init', 'vendor_custom_post_type', 0 );
}
if ( ! function_exists( 'custom_taxonomy_vendor_type' ) ) {
// Register Custom Taxonomy
function custom_taxonomy_vendor_type() {
$labels = array(
'name' => _x( 'Vendor Types', 'Taxonomy General Name', 'maryt' ),
'singular_name' => _x( 'Vendor Type', 'Taxonomy Singular Name', 'maryt' ),
'menu_name' => __( 'Vendor Type', 'maryt' ),
'all_items' => __( 'All Vendor Types', 'maryt' ),
'parent_item' => __( 'Parent Vendor Type', 'maryt' ),
'parent_item_colon' => __( 'Parent Vendor Type:', 'maryt' ),
'new_item_name' => __( 'New Vendor Type', 'maryt' ),
'add_new_item' => __( 'Add New Vendor Type', 'maryt' ),
'edit_item' => __( 'Edit Vendor Type', 'maryt' ),
'update_item' => __( 'Update Vendor Type', 'maryt' ),
'separate_items_with_commas' => __( 'Separate vendor types with commas', 'maryt' ),
'search_items' => __( 'Search Vendor Types', 'maryt' ),
'add_or_remove_items' => __( 'Add or remove vendor types', 'maryt' ),
'choose_from_most_used' => __( 'Choose from the most used vendor types', 'maryt' ),
'not_found' => __( 'Not Found', 'maryt' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'vendor-type', array( 'vendors' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'custom_taxonomy_vendor_type', 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment