0

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

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

Would display something like

  1. Post 2
  2. Post 4
  3. Post 6
  4. Post 1
  5. Post 3
  6. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.