wordpress based price website

Discussion in 'WordPress' started by ironmankho, Dec 16, 2012.

  1. #1
    Hi every one
    i am going to build mobile related website that show price
    higher to low
    for displaying price i am using custom field
    now i am unable to find query is there anybody have idea about this ?
     
    ironmankho, Dec 16, 2012 IP
  2. websolutions85

    websolutions85 Well-Known Member

    Messages:
    316
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Show me your site
     
    websolutions85, Dec 18, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    You're not going to find a query. Queries are specific to the database you're using. You have to write the query (or pay someone to write it for you).
     
    Rukbat, Dec 21, 2012 IP
  4. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #4
    ashishkg, Dec 22, 2012 IP
  5. Deluxious

    Deluxious Greenhorn

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #5
    Name your field whatever you like (just be consistent). So let's say your custom field for price is called "ItemPrice"...

    Your WP_Query for a list of "posts" or items is going to look something like this:

    
    $query = new WP_Query( array ( 'post_type' => 'product', 'orderby' => 'meta_value', 'meta_key' => 'ItemPrice' ) );
    
    Code (markup):
    In order to grab the price while inside the loop, you'd call:

    get_post_meta(the_ID(), 'ItemPrice', true);
    Code (markup):
    Hope this helps.
     
    Deluxious, Dec 22, 2012 IP