• I’m building an event website. The event runs in different countries each year eg London 2012, New York 2012, London 2013, New York 2013, London 2014 etc. Each event has speakers, sponsors and exhibitors and some of these will be involved in more than one event. I have created a custom post type for each of these event contributors. I would like these custom post types to share categories so a speaker and an exhibitor, for example can be assigned to the London 2012, Hong Kong 2013, New York 2013 category. I then want to be able to list all Speakers from London 2012 using query_posts. How can I achieve this? Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I understood that correctly it shouldn’t be too difficult:

    $query = new WP_Query( 'category_name=speakers&post_type=london2012' );

    Where ‘category_name’ is the SLUG of the category (in this case ‘speakers’) and ‘post_type’ is the SLUG of the Custom Post Type (in this case london2012).

    Thread Starter Stefan

    (@stefan83)

    Thanks for your reply, bythegram. Sorry if I’m not clear.

    The main thing is I want to be able to select from the same category list (ie London 2012, NY 2013) for each custom post type (ie speaker, exhibitors etc).

    I’ve added this code to functions.php to enable the categories meta box in the ‘speakers’ custom post type, but this only allows categories created under the ‘speakers’ custom post type. I want the available categories to be from a list used for all custom post types.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post types share categories’ is closed to new replies.