3
votes

I want to create three top level sections within the wp admin area, which then list a group of wordpress custom post types. For eg.

Things to do: (Main Group) - Events (custom post type) - Attractions (custom post type) - Shopping (custom post type) - etc

Accommodation: (Another Main Group) - Hotel (custom post type) - Bed and Breakfasts (custom post type) - etc

I would rather do these and individual custom post types than using a custom taxonomy for better organisation and control.

Also each custom post type will more than likely has further of its own taxonomies applied - eg events might have a taxonomy of outdoors, indoors etc.

I know how to create individual post types, but Im not sure of how to group them in a top level hierarchy.

1

1 Answers

2
votes

Solution is:

  1. Accommodation / Things to do will be template pages

  2. These templates within the admin section will have an option to list the desired post types according to a) post types and b) optionally, further taxonomies

  3. On the front end template, use a code similar to the one below to collect the right data


global $post;
$serialised_post_types = get_post_meta($post->ID,'post_types_to_list',true); //i.e. a serialised array('hotel','bnb');
$serialised_post_types = unserialize($serialised_post_types);
$args = array('post_type' => $serialised_post_types); //basic args

$res = new WP_Query($args);