How would you go about setting the order of the posts using a decimal value in a custom field? I am aware that you would attach your own function to the posts_orderby filter, i have done this and found it easy to order using values in the wp_posts table. I am struggling to do this using a custom field from the wp_postmeta table, would i need to be using the posts_where and posts_join filters also?
Cheers
Jord, is there a special reason not to use one of the my_post_order plugins? There may even be some ajaxy goodness out there...
Is this a special integration issue?
Have you got a link to a specific plugin by any chance? Did do a plugin search but couldn't find one that fitted the above problem.
Cheers for reply btw
I'd love to check out a post order plugin... which is a good one for v2.6.+?
Can't really find a decent plugin for my requirement, so gona probably end up writing my own. Gather inspiration from the above plugin.
if you can make your plugin public, that would be cool, to have another option / another way :)
gabi83tm
Member
Posted 8 months ago #
I'm also looking for a way to use a meta_key with the posts_orderby filter.
I know it's possible. I've checked it out in wp-includes/query.php
I just don't know the syntax. There's no documentation for this filter :(
gabi83tm
Member
Posted 8 months ago #
boldhand
Member
Posted 2 months ago #
Check this link
http://codex.wordpress.org/Template_Tags/query_posts
a way to use a custom field to sort and filter posts.
for example:
query_posts('meta_key=color&meta_value=blue');
Returns posts with custom fields matching both a key of 'color' AND a value of 'blue'
query_posts('meta_key=color');
Returns posts with custom fields matching a key of 'color'
query_posts('meta_key=YOURNAME&orderby=meta_value');