Can we write more than one meta_key?

WordPress Business Themes Forums General Discussion Can we write more than one meta_key?

Can we write more than one meta_key?

November 3, 2017
 Na

  • 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?

    November 3, 2017 at 10:55 am

  • Na
    Newbie 54 points

    The same situation applies to meta_value.

    November 3, 2017 at 11:01 am
  • Josh
    Josh
    Super Guru 13,887 points

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

    November 3, 2017 at 11:49 am

  • 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?

    November 5, 2017 at 2:08 am
  • 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"]

    November 6, 2017 at 12:02 pm

  • 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.

    November 6, 2017 at 2:06 pm
  • 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"]

    November 6, 2017 at 3:51 pm

  • 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.

    November 7, 2017 at 4:55 am

  • 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?

    December 6, 2017 at 1:45 pm
Viewing 9 posts - 1 through 9 (of 9 total)

Didn't find what you were after?

Chat with us now

or contact our support team