I have a query where I'm trying to retrieve posts in two categories, then order it by my custom field in ascending order. I've Googled a lot and can't seem to fix it. Can someone help me with this? I'm not sure what I'm missing. It seemed to work fine on my local installation of WordPress, but isn't working on the live site.
wpcf-sortname is my custom field in the plugin.
I'm using this code on a custom page template.
<?php query_posts(array('category__and'=>array(48,38),'meta_key'=>wpcf-sortname,'orderby'=>meta_value,'order'=>ASC,'posts_per_page'=>-1)); if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a><br /> <?php endwhile; // end of the loop. ?>
Thanks for the help!