WP Alchemy
-
Using this great plugin is it possible to sort by one of my custom meta_values.
eg. I have a custom meta which displays the price, how do I sort in my query to display based on this price.
This is my current state, meta_key => price_low being the name of the field I’d like to base my sort. This set up below doesn’t work unfortunately.<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $post_per_page = 12; // -1 shows all posts $args=array( 'post_type' => 'accommodations', 'community' => 'central-area', 'paged' => $paged, 'posts_per_page' => $post_per_page, 'meta_key' => 'price_low', 'orderby'=> 'ASC' ); $temp = $wp_query; // assign orginal query to temp variable for later use $wp_query = null; $wp_query = new WP_Query($args); if( have_posts() ) :?>
Many thanks in advance.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WP Alchemy’ is closed to new replies.