php - Adding custom field from Easy Property Listing Wordpress plugin -


i'm using easy property listings wordpress plugin (http://easypropertylistings.com.au/) , i'm setting custom fields. have managed working in cms field shows , can input data using following:

function listings_callback($meta_fields) { $custom_field = array(         'id'        =>   'epl-property-listing-custom-data-id',         'label'     =>   __('listing details', 'epl'),         'post_type' =>   array('property'),         'context'   =>   'normal',         'priority'  =>   'default',         'groups'    =>   array(             array(                 'id'        =>   'property_listing_lot_width',                 'columns'   =>   '1',                 'label'     =>   'lot width',                 'fields'    =>   array(                     array(                         'name'      =>   'property_listing_lot_width',                         'label'     =>   __('lot width', 'epl'),                         'type'      =>   'text',                         'maxlength' =>   '150'                     )                 )             )         )     ); $meta_fields[] = $custom_field; return $meta_fields; } add_filter( 'epl_listing_meta_boxes' , 'listings_callback' ); 

now i'm trying add custom field on front end in template have no idea how call it.

any appreciated i've looked through documentation , can't seem find help.

i figured out how go , thought share answer in case else having same issue.

after code above required following:

function my_custom_text_field_callback() { global $property;  $custom_text_field = $property->get_property_meta('property_listing_lot_width'); if ( isset($custom_text_field) ) {     echo $custom_text_field; } } // add after the_content of listing add_action( 'epl_property_content_after' , 'my_custom_text_field_callback' ); 

the code depends on type of field pulling. there instructions here on if using different fields such 'numbers' or 'select boxes'.

http://easypropertylistings.com.au/docs/epl_listing_meta_boxes-filter-all-available-meta-fields/

then once setup in functions.php need add following template file call field:

<?php do_action('epl_property_content_after'); ?> 

i think is got confused trying call 'my_custom_text_field_callback' instead of 'epl_property_content_after.

also don't forget check have text written in cms. found if made changes naming fields content disappear.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -