Title: WP Alchemy
Last modified: August 19, 2016

---

# WP Alchemy

 *  [daztayor](https://wordpress.org/support/users/daztayor/)
 * (@daztayor)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/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)

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/wp-alchemy/#post-1875410)
 * Start with setting the `orderby` value properly.
 *     ```
       'orderby'=> 'ASC'
       ```
   
 * `ASC` is applicable to the `order` parameter, which chooses the direction to 
   order in.
 * Set `orderby` to `meta_value` or `meta_key`, and `order` to either `ASC` or `
   DESC`.
 *  [farinspace](https://wordpress.org/support/users/farinspace/)
 * (@farinspace)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/wp-alchemy/#post-1875475)
 * If you are indeed referring to the WPAlchemy code, read the following, [wpalchemy meta box storage](http://farinspace.com/wpalchemy-metabox-data-storage-modes/)
   article, I will be soon revising the code to make this aspect of interaction 
   much easier for end users.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP Alchemy’ is closed to new replies.

## Tags

 * [orderby](https://wordpress.org/support/topic-tag/orderby/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [farinspace](https://wordpress.org/support/users/farinspace/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/wp-alchemy/#post-1875475)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
