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
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-attributes
to the supports
argument in register_post_type.
Why not have the custom post type be hierarchical and support the page-attributes box?
-
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.BrownCommented Nov 7, 2011 at 21:41
-
You can use the menu order to order the posts in the query for the loop. Commented 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.BrownCommented Nov 8, 2011 at 2:11
-
I don't know right at the moment, but that's probably worth asking another question for :) Commented 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.BrownCommented Nov 8, 2011 at 3:31