Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking to create a group of static pages for a "staff" category, and then have a separate menu option for them in the dashboard, similar to the "pages" option that already exists. What I'm wondering is if there's a built in wordpress functions that would speed along this development. If you have a suggestion on where to start looking, that would be great, as my current searches are stymied by countless tutorials of how to add a new page or how to duplicate a page, as opposed to duplicating the "pages" menu.

Apologies for the broad, vague nature of this post. I'm new to wordpress, and I'm still absorbing this vast knowledge base.

share|improve this question
    
Hm, you actually don't need to duplicate data. There's a simple way to achieve this. But Pages don't have Categories, are you trying to mean Posts ? –  Shazzad Jul 14 at 17:48

3 Answers 3

up vote 2 down vote accepted

Not as vague as you might think. This is a very commonly used approach. What I would suggest you focus on is creating a custom post type. This will give you the admin menu item, categories (or any taxonomy structure you like) and many other features.

CPTs are very simple to register and modify. They are perfectly suited for storing data such as products in a store, destinations for a travel site, etc.

Full documentation for the register function ( register_post_type() ) can be found here

share|improve this answer
    
This is exactly what I was looking for. Thank you for the guidance. –  Iso Jul 14 at 18:21
    
You are quite welcome. Happy to help with any follow-up questions you might have. Welcome to WordPress and good luck with your project. –  jdm2112 Jul 14 at 18:23
    
If this information provided a solution for you, please do not forget to accept the answer so that others may be helped in the future. –  jdm2112 Jul 14 at 18:25

You'll want to register your own custom post type. Rather than try and get your head around how to do this properly (as referenced in other answers), I'd recommend you add this to your functions file and adjust as needed:

function custom_post_type() {

// Set UI labels for Custom Post Type
$labels = array(
    'name'                => _x( 'Staff', 'Post Type General Name' ),
    'singular_name'       => _x( 'Staff', 'Post Type Singular Name' ),
    'menu_name'           => __( 'Staff' ),
    'parent_item_colon'   => __( 'Parent Staff' ),
    'all_items'           => __( 'All Staff' ),
    'view_item'           => __( 'View Staff' ),
    'add_new_item'        => __( 'Add New Staff' ),
    'add_new'             => __( 'Add New' ),
    'edit_item'           => __( 'Edit Staff' ),
    'update_item'         => __( 'Update Staff' ),
    'search_items'        => __( 'Search Staff' ),
    'not_found'           => __( 'Not Found' ),
    'not_found_in_trash'  => __( 'Not found in Trash' ),
);

$args = array(
    'label'               => __( 'staff' ),
    'description'         => __( 'Staff List'),
    'labels'              => $labels,
    // Features this CPT supports in Post Editor
    'supports'            => array( 'title', 'author', 'revisions', 'author', 'thumbnail', 'excerpt', 'revisions', 'page-attributes'),
    // You can associate this CPT with a taxonomy or custom taxonomy. 
    'taxonomies'          => array( 'category' ),
    /* A hierarchical CPT is like Pages and can have
    * Parent and child items. A non-hierarchical CPT
    * is like Posts.
    */  
    'hierarchical'        => false,
    'public'              => true,
    'show_ui'             => true,
    'menu_icon'           => 'dashicons-businessman',
    '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'     => 'page',
);

// Registering your Custom Post Type
register_post_type( 'staff', $args );
}
add_action( 'init', 'custom_post_type', 0 );

You can then make a single-staff.php and archive-staff.php to display staff results. With the taxonomy of category seen above, it will set up categories so you can use that to create a menu item.

share|improve this answer

There's a great plugin for creating and editing menu items in the wp-admin. Check it out here:

https://wordpress.org/plugins/admin-menu-editor/

You can create custom menu items with that. You may also need to create a custom post type or a page with the text or content on it that you want the new menu link to load.

It's good practice to use plugins for anything that's generating content in wordpress. As apposed to coding it directly into a theme.

Hope this helps!

share|improve this answer
1  
I have to heartily disagree with the "good practice to use plugins" statement. What are you basing that on? Take a poll of experienced developers and you will likely find the answer is to NOT use a plugin if you can avoid. That being said, there are many quality plugins available for Wordpress. A few lines of custom code tailored to do a certain job are certainly preferred to the plugin bloat we have to clean up for many clients. –  jdm2112 Jul 14 at 18:12
    
That's an old train of thought I once had too. These days you'll hear from many developers that keeping content generating functionality in plugins is ideal. An influential advocates for this is Justin Tadlock. Look him up. If a theme has a content generating function built into it (custom post types) the user is going to lose that functionality when they change themes. The more content generation in a theme, the harder it is to switch themes and work with that content. If we keep this stuff in a plugin, then it's still there when a theme is changed, and it's easier to work with. –  Mark.C Jul 14 at 18:35
    
Now that is a statement I can agree with. I put all my CPT definitions into a plugin. Even when building custom themes from scratch, that is perferred over placing that code in the functions file. Your original wording appeared to encourage off-the-shelf plugins, however. –  jdm2112 Jul 14 at 18:40
    
Thanks :) Well I might still encourage off the shelf plugins if they are generating content or adding meta boxes on pages, posts, or theme options. That way you can retain all the content and admin fields when you switch themes later. I know there's still a need to hard code some functionality per theme. But my general practice is to do that in plugins or use plugins when it's related to creating content. I think we both agree with parts of each others statements. –  Mark.C Jul 14 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.