Can we write more than one meta_key?


  • Na
    Newbie
     
    54 points

    let’s say meta_key=featured&id. I tried but failed. Any suggestion for writing more than one meta_key in the same query?



    Na
    Newbie
     
    54 points

    The same situation applies to meta_value.


    Josh
    Josh
    Super Guru
     
    13,887 points

    Hello Na,
    Should be:
    meta_key=featured&meta_value=yes&meta_key=id&meta_value=yes



    Na
    Newbie
     
    54 points

    I open a page (for a specific custom field) in which I want to put featured listing first, then normal listing.

    I enter the query: meta_key=featured&meta_value=yes&order=desc&meta_key=(the name of the custom field)&meta_value=(the name of the value)&order=desc

    The result shows “meta_key=(the name of the custom field)&meta_value=(the name of the value)&order=desc” only and the featured listings aren’t on the top.

    Then I try to delete &order=desc in both query, but the result doesn’t change.

    Any suggestion?


    Josh
    Josh
    Super Guru
     
    13,887 points

    Hello Na,
    You mean you want to display featured listings first?Why not use 2 shortcodes?(Am guessing you are using a shortcode if using Page Builder simply use 2 objects with the object to display featured listings coming first)

    [LISTINGS grid=true show=50 query="meta_key=featured&meta_value=yes"]
    or
    [LISTINGS grid=true show=50 query="meta_key=second-option&meta_value=yes"]



    Na
    Newbie
     
    54 points

    The problem is, if I show featured listing as the first, all kinds of featured listings will show in the page. For example, I want to show featured listing with sale as the first in the page, then show listings with normal priority as the second. Your method will show all featured listings with sale, rent in the same page. That is not what I want.


    Josh
    Josh
    Super Guru
     
    13,887 points

    You can still use the options I provided above.

    Featured For Sale:[LISTINGS grid=true show=50 query="meta_key=featured&meta_value=yes&meta_key=sales&meta_value=yes"]
    Featured For Rent:[LISTINGS grid=true show=50 query="meta_key=featured&meta_value=yes&meta_key=rent&meta_value=yes"]
    All: [LISTINGS grid=true show=50]
    All sales: [LISTINGS grid=true show=50 query="meta_key=sales&meta_value=yes"]
    All Rent:[LISTINGS grid=true show=50 query="meta_key=rent&meta_value=yes"]



    Na
    Newbie
     
    54 points

    I follow your steps, but no luck. I have sent you the email with the details. Hope you feel free to take a look.



    Na
    Newbie
     
    54 points

    I wonder if premiumpress can make featured listing first, then normal listing. I once opened a ticket, seeking for help, but the a staff replied me “there is no option for that”. I really need this. Anybody can suggest a solution?


Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.