Changing format of epl_property_available_dates

Easy Property Listings WordPress Real Estate Plugin Forums Basic Support Changing format of epl_property_available_dates

Tagged: , , ,

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

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

  • Author
    Posts
  • #13862
    willhouse
    Participant

    I am trying to format the date found in “template-functions.php” on line 668, “function epl_property_available_dates()”/

    Currently the display of the date is “day of week” “numerical date”, “month”.

    For this website we would like to display dates with “day of week”, “month” “numerical date”

    I have created my own function based on the epl_property_available_dates() and called that in my content-listing-single.php template override.

    Is there a way to quickly re-format the date using php “Date” format?

    Or is there a setting within the plugin admin that I can set to format?

    I tried setting the WordPress date format at Settings > General but this still did not effect the output of the plugin.

    Any help would be greatly appreciated.

    Thanks,
    Richard @ Willhouse

    • This topic was modified 6 years, 12 months ago by willhouse.
    #14312
    willhouse
    Participant

    Just in case anyone needs to reformat the date for the “Date Available” in rentals here is the custom function that I created to do it (copy and paste the below in your functions.php file):

    function my_property_available_dates() {
    	global $property;
    	if( 'rental' == $property->post_type && $property->get_property_meta('property_date_available') != '' && $property->get_property_meta('property_status') != 'leased' ) { 
    		// Rental Specifics
    		$date = $property->get_property_available();
    		$t1 = strtotime($date);
    		$d1 = getdate($t1);
    		$long = "F j, Y";
    		echo '<div class="date-available">Property Available: ';
    		printf("%s", date($long, $t1));
    		echo '</div>';
    	}
    }
    add_action('my_property_available_dates','my_property_available_dates');

    and then, in your “content-listing-single.php” template file (remember to create a folder called “easypropertylistings” and place a copy of this file in your theme to override the EPL templates) you can replace the original <?php do_action('cps_property_available_dates');// meant for rent only ?> with the new custom function to display the reformatted date: <?php do_action('my_property_available_dates');// meant for rent only ?>

    For more date formats check out the PHP page: http://php.net/manual/en/function.date.php

    Hope this helps.

    -Richard @ Willhouse

    #14315
    Merv Barrett
    Keymaster

    Great function Richard. You can apply it using the existing hook instead of modifying the template with a new hook using.

    Change
    add_action('my_property_available_dates','my_property_available_dates');

    to
    add_action('epl_property_available_dates','my_property_available_dates');

    and add
    remove_action('epl_property_available_dates','epl_property_available_dates');

    #1447288
    Merv Barrett
    Keymaster

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

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