Skip to content

Instantly share code, notes, and snippets.

@huwrowlands
Created August 24, 2014 21:49
Show Gist options
  • Select an option

  • Save huwrowlands/4b481cdd37e8abc5a839 to your computer and use it in GitHub Desktop.

Select an option

Save huwrowlands/4b481cdd37e8abc5a839 to your computer and use it in GitHub Desktop.
CPT - Services
<?php
// Register Custom Post Type
function register_services_post_type() {
$labels = array(
'name' => _x( 'Services', 'Post Type General Name', 'weaver' ),
'singular_name' => _x( 'Service', 'Post Type Singular Name', 'weaver' ),
'menu_name' => __( 'Services', 'weaver' ),
'parent_item_colon' => __( 'Parent Service:', 'weaver' ),
'all_items' => __( 'All Services', 'weaver' ),
'view_item' => __( 'View Service', 'weaver' ),
'add_new_item' => __( 'Add New Service', 'weaver' ),
'add_new' => __( 'Add New Service', 'weaver' ),
'edit_item' => __( 'Edit Service', 'weaver' ),
'update_item' => __( 'Update Service', 'weaver' ),
'search_items' => __( 'Search Services', 'weaver' ),
'not_found' => __( 'No Services found', 'weaver' ),
'not_found_in_trash' => __( 'No Services found in Trash', 'weaver' ),
);
$rewrite = array(
'slug' => 'outsourced-marketing-services',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'services', 'weaver' ),
'description' => __( 'Marketing Services', 'weaver' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
//'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-aside',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'services', $args );
}
// Hook into the 'init' action
add_action( 'init', 'register_services_post_type', 0 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment