0

Im looking for a way to add a custom meta box to a custom post type that will allow the user/client order the posts to show up how they want on the site. Is this possible? Basically using a very similar functionality to "page attributes"...

2 Answers 2

2

You can add page-attributes support to the post type. This will cause a meta box to appear with an "order" field to do just what you want.

eg.

   <?php
   add_post_type_support('your_custom_post_type', 'page-attributes');

Or you add page-attributesto the supports argument in register_post_type.

1

Why not have the custom post type be hierarchical and support the page-attributes box?

6
  • Hi, can you extrapolate on that a bit? Not following the logic of your suggestion yet. To my knowledge page-attributes only applies to "menu order" which is not what Im trying to use it for
    – Mr.Brown
    Nov 7, 2011 at 21:41
  • You can use the menu order to order the posts in the query for the loop. Nov 8, 2011 at 2:06
  • Hmm...i did not know this actually. I started to try it since you said it works like that but i ran into a snag...any idea why my custom columns thumbnail images are disappearing when I decide to set hierarchical to true?
    – Mr.Brown
    Nov 8, 2011 at 2:11
  • I don't know right at the moment, but that's probably worth asking another question for :) Nov 8, 2011 at 2:29
  • Are you sure that the page-attributes order field can be used for "post order"? I looked in the docs and it only refers to "page order" instead unless Im missing something??
    – Mr.Brown
    Nov 8, 2011 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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