Helping you Build Your Own Social Network!

Faster, better and easier!

multi-relational taxonomy archive pages -- rather advanced questions

(3 posts) (2 voices)

Tags:

No tags yet.


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

    register_taxonomy('series', array('post','page','sermons','podcasts'),
    array(
    	'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.

    example:
    http://deardaddy.org/series/unidos-messages/

    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'.

    So far my only solution has been to use multiple loops, one for each type 'sermons, podcasts, posts, pages' in order to style them differently. Otherwise they all blend together and look even worse.

    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:

    sermons:
    --sermon 1
    --sermon 2
    --sermon 3
    podcasts:
    --podcast 1
    --podcast 2
    --podcast 3
    posts:
    --post 1
    --post 2
    --post 3
    pages:
    --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?

    Posted 2 years ago #
  2. Hi Shawn, that is a cool project. I was just thinking of how it could be done. I haven't played with custom taxonomies before but based on Justin's tutorials here and here, this is how I would start with the experimentation:

    e.g. Sermons:
    <?php query_posts( array( 'series' => 'sermons', 'showposts' => 10 ) ); ?>

    which just shows you what I know about using taxonomies :-)

    I've found this code in WordPress.org forums which I think could help you out like this.

    Posted 1 year ago #
  3. @mercime
    Thank you! Actually while only somewhat related to my situation, that post gives me a few ideas to try out. You really may be onto something there.

    Posted 1 year ago #

Reply

You must log in to post.