Custom order posts in current taxonomy

I’m having a few problems trying to code a solution to the following – any help anyone can offer would be much appreciated 🙂

At the moment my website orders posts in the current category by a numeral custom field of each post, excluding any posts that are also in cat ID 283.

<?php
query_posts($query_string.’&cat=-283&meta_key=savings&orderby=meta_value_num&order=DESC’);
if (have_posts()) : ?>

Ideally I’d like to be able to do this:

List all posts in the current category (that aren’t also in category ID 283) ordered by a numeral meta key (same as above)

and then once it’s finished listing all these posts, then start listing the posts which feature in BOTH the current category AND category ID 283, ordered by a numeral meta key.

So for posts

Post 1. > in Current category & 283 > Meta key = 10
Post 2. > in Current category > Meta key = 10
Post 3. > in Current category & 283 > Meta key = 9
Post 4. > in Current category > Meta key = 9
Post 5. > in Current category & 283 > Meta key = 8
Post 6. > in Current category > Meta key = 8

Would display something like

Post 2
Post 4
Post 6
Post 1
Post 3
Post 5

This would need to work across multiple pages ( i.e. http://www.yourdomain.co.uk/category/page/2/ etc ) as some categories have 100’s of posts.

If anyone can offer me any advice or pointers then this would be much appreciated 🙂

Thank you in advance

Joey

Read more here:: Custom order posts in current taxonomy

Leave a Reply

Your email address will not be published. Required fields are marked *