I want to know how to add a new submenu for a custom post type in creating a wordpress plugin.
What I have done for now, I’ve created a custom post type called ‘funds’.
add_action( 'init', 'wnm_add_funds' );
function wnm_add_funds() {
register_post_type('wnm_funds',
array(
'labels' => array(
'name' => __( 'Funds' ),
'add_new' => __( 'Add New Fund' ),
'add_new_item' => __( 'Add New Fund' ),
'edit_item' => __( 'Edit Fund' )),
'public' => true,
'has_archive' => true,
'menu_position' => 100
)
);
}
This code adds a custom post type called ‘Funds’ and under it is two submenus (‘funds’,’add new fund’). What I would like to do is to add new submenu under funds. Example I would like to add ‘Fund Settings’, so under funds there will be (funds,add new fund,fund settings).
how would i do that?
You can do this with:
http://codex.wordpress.org/Function_Reference/add_submenu_page
http://codex.wordpress.org/Roles_and_Capabilities
I don’t know if the capability is set right for your cause, but this will work
To add settings/options to the page I recommend the settings API
A good (and bit long) tutorial how to use this: http://wp.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-1/