• Resolved sarahweb

    (@sarahweb)


    I am really struggling to figure this out

    On the listing page using loop_listing_blog_default you get

    Thumbnail
    Address
    Title
    Bedroom
    extract
    price/bond

    However I wanted to add some other items ie
    Furnished/Unfurnished
    Initial Period
    Property Type
    Num Bedrooms

    etc etc

    I have been trying to follow some of your instructions but they don’t seem to be displaying the correct info – using this page:
    https://codex.easypropertylistings.com.au/article/85-rental-listing-custom-meta-fields

    I have been trying this
    <?php do_action( ‘epl_property_furnished’ ); ?>
    nothing displays (nor does “property_furnished”)
    I managed to get “Available from” using this line
    <?php do_action( ‘epl_property_available_dates’ );// meant for rent only ?>
    which I got from a single listing template – however I cannot find another list of what other items I can use in “do_actions” the page I linked too above doesn’t have “epl_property_available_dates” it has “property_date_available” so I am not sure that its the right page to look at

    Basically I am trying to locate how I echo out any of the information located via the XML insert?

    I know how to edit the template but you don’t actual say what the field names are called to echo them out

    Bit like

    <?php do_action(‘epl_property_price’); ?>

    Actually displays “£2,500/ Monthly£3,750 Deposit” where as I actually wanted to have price on its own and deposit/bond later on – as an example

    Not sure if documentation matches the latest version or whether I am looking at the wrong page

    Any help appreciated

    Thank you Sarah

    https://www.ads-software.com/plugins/easy-property-listings/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter sarahweb

    (@sarahweb)

    posted a priority support ticket for this as realised you don’t use this forum anymore!

    please post answer here when you figure it out ??

    Plugin Author Merv Barrett

    (@mervb1)

    Hi Sarah,

    Not quite how you use a do_action, you can only use the ones that are available.

    A do_action is a place to hook in something to.

    WordPress do_action
    — Execute functions hooked on a specific action hook.

    So to add features property_furnished meta field you can use the get_property_meta function and you would do this in the template like this

    <?php echo $property->get_property_meta('property_furnished'); ?>

    Ensure that your template file has the global $property at the beginning in php like here
    https://github.com/easypropertylistings/Easy-Property-Listings/blob/master/lib/templates/content/loop-listing-blog-default.php

    All the available do_actions are in the single template
    https://github.com/easypropertylistings/Easy-Property-Listings/blob/master/lib/templates/content/content-listing-single.php

    These are the meta fields that are in the plugin.
    https://github.com/easypropertylistings/Easy-Property-Listings/blob/master/lib/meta-boxes/meta-boxes.php

    Now back to the property_furnished when you echo that you will get the value which in this case is yes…

    so you can create a custom function to display the words instead or an icon etc

    <?php
    function my_property_furnished() {
    global $property;
    
    $furnished = $property->get_property_meta('property_furnished');
    
    if ( $furnished == 'yes' ) {
    // Do Something
    echo '<span class="my-furnished-class">this listing is furnished</span>;
    }
    }
    add_action( 'my_extra_listing_details' , 'my_property_furnished' );
    
    ?>

    WordPress add_action

    NOW here is how you can use the do_action to output the furnished onto your template instead of having a messy template with lots of if else statements

    in your template you can add a do_action where you want to output the furnished or other items

    do_action( my_extra_listing_details);

    OR you can use an existing do action already in the template where you change in the above example.

    CHANGE
    add_action( 'my_extra_listing_details' , 'my_property_furnished' );

    TO

    add_action( 'epl_property_after_content' , 'my_property_furnished' ); // this will add it to the epl_property_after_content do_action hook

    Repeat for the other items you have by creating mini functions or a single one with all the extra bits you need,

    Thread Starter sarahweb

    (@sarahweb)

    thanks Merv – that has helped heaps!

    a few more items that I need to hunt down but I will post if I don’t find the answers

    Plugin Author Merv Barrett

    (@mervb1)

    Glad to help you out

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding more details into the listing pages’ is closed to new replies.