"Featured" selection – conditional check

Easy Property Listings WordPress Real Estate Plugin Forums Basic Support "Featured" selection – conditional check

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

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

  • Author
    Posts
  • #11691
    ck1066
    Spectator

    Hi,

    I wonder if anyone can help.

    How do I check to see whether the “featured” box in the display details section of a property has been selected, when adding or editing a property for each of the CPT?

    If it has been selected I want them to be redirected to another function, yet to be decided.

    Thanks in advance.

    #11724
    Merv Barrett
    Keymaster

    Great question.

    All the meta for a listing is stored in a global variable $property where you can access any listing data.

    For example

    function my_featured_property() {
        global $property;
        $meta_key = 'property_featured';
        $result = $property->epl_property_meta($meta_key);
        echo $result;
    }

    That will just echo “yes” if featured is ticked but you can use that as a template to build your function with.

    Also all meta is stored in the exact way WordPress works so you can also use that syntax to retrieve custom meta. Our global $property is a faster way of returning data vs using get_post_meta( $post_id, $meta_key );

    • This reply was modified 8 years, 11 months ago by Merv Barrett.
    #11726
    Merv Barrett
    Keymaster

    Additionally when editing a listing right click and inspect a field the name of the meta key is there and they all start with the prefix property_

    property_address_street
    property_bedrooms

    #11805
    ck1066
    Spectator

    Once again thanks Merv.

    #12633
    billy
    Spectator

    Merv, how is EPL designed to use this Featured Property selection? I will likely create a custom query to show X number of featured properties on the front page, but before I reinvent the wheel I wanted to ask you about it, because I don’t see a built-in way of using it but I’m sure there must be one.

    #12634
    billy
    Spectator

    Actually, I just answered my own question. No custom query is necessary. I’ll post the answer here for anyone else who wants to know. Just using the shortcode [listing property_featured=”yes”] outputs any properties where the Featured Property button is ticked ‘Yes’.

    What an amazing plugin this is! I’m really impressed with all the work that’s gone into it.

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Basic Support’ is closed to new topics and replies.