I have a custom meta field that I want to use to sort with query_posts
but its not ordering my posts properly since it is a datestamp (i.e. 04/21/2014) and its treating it like a normal text string.
I thought about converting the field using strtotime
but that doesn't work.
$args = array( 'meta_key' => strtotime('pexpires'), 'orderby' => 'meta_value', 'order' => 'desc', 'post_type' => 'post', 'showposts' => '60', ); $query = query_posts($args);
'meta_key' => strtotime('pexpires')
.strtotime
will simply returnfalse
, as no valid date string is passed. A further look in the WP codex might help a well: codex.wordpress.org/Class_Reference/…