Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a category page called 'features' this is all fine, but the posts in the features category also belong to a certain genre of film, and it's this what I want to order the posts by on the actual features category template.

eg

features cat template brings in all features posts.

then what I want to do is display in alpha order by whatever genre it also belongs to

features
      action
         post
         post
         post
      comedy
         post
         post
       sci-fi
         post
         post

etc.

this is what I have at the moment ( the cat numbers relate to the genres = action=10 etc)

query_posts('cat=10,11,12,13,14,15,16,17,18&orderby=title&order=DESC' );

                        while (have_posts()) : the_post(); ?>

How can I list all the posts (group them) by genre ? when I use title here i guess it's using the posts title.

Playing around if I stick this in the post loop

<?php
                        foreach((get_the_category()) as $childcat) {
                        if (cat_is_ancestor_of(4, $childcat)) {
                        echo $childcat->cat_name;
                        }}

this returns the actual genre cat for each post while in the loop, but I'm not sure how to stick it together so I can state the ordering of the posts by groups of genre, I was hoping I could do this in the query_posts?

Any help in the right direction would be greatly appreciated

Thanks

MRO

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.