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.

My scenario is as follows:

Categories:

 1. Category A
     - Sub-Category A1
     - Sub-Category A2
     - Sub-Category A3
 2. Category B
     - Sub-Category B1
 3. Category C
 4. Category D

The Category template has a list of all posts that belong to that relevant Category and are ordered by Menu_Order.

My problem is that if a single Post happens to fall under multiple categories (Sub Category A1 and Category C), I can only set a generic menu_order in Wp-Admin and it is not Category specific.

I would like a Post to be ordered something like this:

Single Post

- Category A: Menu_order 3
- Category A2: Menu_order 2
- Category C: Menu_order 11

Is there a way for me to set the menu_order for a post when it's under Category A1 and then another menu_order for Category C?

I've read this: Different post sort order within different categories and I think this may help, but I'd like to know if there is a quicker and simpler way.

I'm using the latest WordPress 3.8, Advanced Custom Fields 4.2.2 (to populate post content) and I've created a CPT in my functions.php.

Edit: I've begun constructing the custom fields in my Category Edit screen as suggested in the first answer.

Currently it is a jQuery sortable ul list of Post titles, each with the relevant post_ID as the id of the li

I think the best approach for me now would be to have an AJAX call after every jQuery re-sort that sends an array of post_IDs to a function that will write to the DB.

Edit 2:

I've successfully managed to store the sortable order in a database using a function.

My next step is to look into WP_Query and seeing if we can use an array of posts to determine an output order.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can't set multiple "menu_orders" specifically. There is one spot for that value in the posts table. You should be able to solve this by creating your own category specific menu order with custom meta fields.

I wouldn't call this a difficult project but there is a bit of work to it.

  1. You are going to need to create meta boxes to manage the custom menu order
  2. Or tediously hand write into the default custom meta box
  3. And alter your queries, where necessary, to sort on your custom fields.

I would suggest getting started with an implementation and asking more specific questions as you have problems. I don't have the time to cook this up for you wholesale, and I am not sure there is detail enough in the question even if I had the time.

share|improve this answer
    
Good suggestion, I decided to take this route prior to your answer so it's good to say I'm on the right track at least. I'll be updating the question above with my progress. –  Ashley D Jan 10 at 8:30

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.