I am trying to sort posts based on a custom value and to do that I have tried replacing
<?php while ( have_posts() ) : the_post(); ?>in my theme code to both
<?php while ( query_posts('meta_key=326_dtg&orderby=meta_value') ) : the_post(); ?>and
<?php while ( have_posts() ) : query_posts('meta_key=326_dtg&orderby=meta_value'); ?>) : the_post(); ?>but both of those simply get the same item to be displayed infinitely, in short it doesn’t works.
So my question is, what am I doing wrong ( I have been around PHP a little but not equally around wordpress so not sure what I am doing here ) and using this technique will mean creating three separate index pages i.e. one for then newest items ( WP’s default ), another one for ascending order ( lowest items first ) and the third one for descending order ( highest items first ). I am sure this is not best practice, but still is it way out of the circle?
- The topic ‘Sort posts based on a custom field’ is closed to new replies.