0

I believe what I am trying to achieve is quite easy but I am failing to grasp what is needed here.

I want a section in the admin panel... lets say "page sections"

under that, I want to be able to add multiple post types. i.e. lets say

"add member", "add foo", "add bar" ...

I currently have

add_action( 'init', 'add_item' );
add_action( 'init', 'add_item2' );
function add_item(){
    register_post_type('item1', array(
        'label' => 'Item label',
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'capabilities' => array(

        ),
        'hierarchical' => true,
        'rewrite' => array('slug' => 'puds'),
        'query_var' => true,
        'supports' => array(
            'title',
            'editor',
            'excerpt',
            'custom-fields',
            'revisions',
            'thumbnail',
            'author',
            'page-attributes',
            'post-formats'
        )
    ) );
}
function add_item2(){
register_post_type('item2', array(
    'label' => 'Item label 2',
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'page',
    'capabilities' => array(

    ),
    'hierarchical' => true,
    'rewrite' => array('slug' => 'puds'),
    'query_var' => true,
    'supports' => array(
        'title',
        'editor',
        'excerpt',
        'custom-fields',
        'revisions',
        'thumbnail',
        'author',
        'page-attributes',
        'post-formats'
    )
) );

}

which would generate

enter image description here

but i want one menu heading with more than one menu selection...

Any ideas?

1

Sorry, try this:

'show_ui' => false,
'menu_position' => 'edit.php?post_type=main_posttype or registered section'

For example if you want it under Themes it would be:

'menu_position' => 'themes.php'

This on your post type registering.

0

I think you might check the labels docs for post types like this:

function codex_custom_init() {
  $labels = array(
    'name' => _x('Books', 'post type general name'),
    'singular_name' => _x('Book', 'post type singular name'),
    'add_new' => _x('Add New', 'book'),
    'add_new_item' => __('Add New Book'),
    'edit_item' => __('Edit Book'),
    'new_item' => __('New Book'),
    'all_items' => __('All Books'),
    'view_item' => __('View Book'),
    'search_items' => __('Search Books'),
    'not_found' =>  __('No books found'),
    'not_found_in_trash' => __('No books found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => __('Books')

  );
  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
  ); 
  register_post_type('book',$args);
}
add_action( 'init', 'codex_custom_init' );

Check: http://codex.wordpress.org/Function_Reference/register_post_type

  • but that doesn't answer the question... I have already got that far... – Phil Jackson Aug 16 '12 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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