Support » Alpha/Beta/RC » 3.0 custom taxonomies registered to multiple post_types question

  • I run the following function in my themes functions.php file:

    register_taxonomy('series', array('post','page','sermons','podcasts'),
    	'labels' =>array(
    	    'name' => _x('series', 'taxonomy general name'),
    	    'singular_name' => _x( 'series', 'taxonomy singular name'),
    	    'search_items' => __( 'Search Series' ),
    	    'popular_items' => __( 'Popular Series' ),
    	    'all_items' => __( 'All Series' ),
    	    'parent_item' => __( 'Parent Series' ),
    	    'parent_item_colon' => __( 'Parent Series:' ),
    	    'edit_item' => __( 'Edit Series' ),
    	    'update_item' => __( 'View Series' ),
    	    'add_new_item' => __( 'Add New Series' ),
    	    'new_item_name' => __( 'New Series Name' ),
       	 'hierarchical' => true,
       	 'show_ui' => true,
       	 'query_var' => true,
       	 'rewrite' => array( 'slug' => 'series' ),

    As you can see in above, the tax ‘sermons’ is attached to (posts, pages, sermons, podcasts)

    That works perfectly and as expected.

    Where I am stuck and need help:

    I have an ‘archive’ listing page for the tax ‘series’. On that page, all post_types are returned for the tax ‘series’ in the order they were posted.

    test site

    The reason you always see what seems like duplicate posts, is because every time I create a new sermon, I also create a new matching podcast. Both the sermon and podcast contain the same tax ‘series’.

    What I want to accomplish:

    I want to separate out the displayed information via post_type. This means the archive page for tax ‘series’ would look like this:

    –sermon 1
    –sermon 2
    –sermon 3
    –podcast 1
    –podcast 2
    –podcast 3
    –post 1
    –post 2
    –post 3
    –page 1
    –page 2
    –page 3

    What I need to do this:

    I need some type of example wp_query that would return each post_type with pagination, so that I can create 4 loops, 1 for each post_type that belongs to tax ‘series’.

    I have searched high n’ low, but to date I have not seen even a hint of an example of how to do this anywhere.

    I do realize this is getting beyond the normal wp operations, and relatively advanced, but I can handle it. Just need some starting pointers.

    It’s possible that I may end up figuring out the multi-loops issue, but adding in pagination on a per post_type within the archive page, is going to be really really interesting.

    by any chance is anyone willing to help me tackle this issue?

Viewing 1 replies (of 1 total)
  • This should work:

    foreach ( array('sermon', 'podcast') as $post_type ) {
        query_posts(array('post_type' => $post_type, 'series' => 'x'));
        while ( have_posts() ) : the_post();
            // display code

    I’m not sure what kind of pagination would make sense with this layout, though.

Viewing 1 replies (of 1 total)
  • The topic ‘3.0 custom taxonomies registered to multiple post_types question’ is closed to new replies.