Order By Meta Value Problem
-
Hello,
I searched but couldn’t find a solution to my problem.
I’m using Magic Fields plugin for custom fields.
For some post types i added order fields like ‘homepage_list_order’. But this field is not required.
What i’m trying to do is if a value has been entered to ‘homepage_list_order’ use it if not put the post at the end of the list.
Let’s say i have 10 posts.
I want to show all of them on my homepage but with my custom order field ‘homepage_list_order’.
I want to enter ‘homepage_list_order’ value for only 3 of them.
When i open my homepage the 7 of them is at the top of the list and the 3 of them at the end.
I guess, when i orderby meta_value_num, WP gets post but if field is empty, WP puts it on the top of list as considering the value is 0. However i want posts that have no meta_value at the end of the list. If i entered value for Post_5, Post_2, Post_9, i want just these 3 at top.
Sometimes i have 100 posts and just want 3 of them to be at top. Even if i entered a value for these three like 1,2,3 they always are at bottom.
I hope i could make you understand.
Any help would be nice.
Thank you.
- The topic ‘Order By Meta Value Problem’ is closed to new replies.