I've read umpteen answers and questions about things that are very similar to this but I just can't get it to work for my specific situation.
I have some posts with a category of "property
". In category.php
I want these posts to appear in date order initially/ASC
(as per usual).
I then want to have a dropdown menu, which gives the option of viewing:
- price high to low
- price low to high
- latest (default).
Each post has been assigned a custom field of "property_price
" which is a numeric value.
I also need pagination to work.
Initial goes with this as my query_post:
<?php if (have_posts()) : ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("meta_key=property_price&orderby=meta_value_num&order=ASC&paged=$paged"); ?>
<?php while (have_posts()) : the_post(); ?>
This just renders a list obviously. However, even at this point, I am stuck as WordPress insists on ordering things like this: 1, 10, 100, 2, 3 so not actually in proper order. I thought using orderby=meta_value_num
was supposed to sort this out?
If anyone can help I'd be very grateful. Be gentle on me, I'm no expert so fool-proof instructions gladly received.
Thanks in advance.