how do i change this to show regular hours instead of military time? thanks!
Here is a way you could at least change it on the website listing using the child theme method: In your child theme directory create a folder called widgets.
Place a copy of /DT9/_directory/widgets/widget-openinghours.php into this directory. Now, open the the widget-openinghours.php and replace line #115:
<span><?php echo date('H:i A', strtotime($bh['start'][$i])); ?> - <?php echo date('H:i A', strtotime($bh['end'][$i])); ?></span>
<span><?php echo date('h:i A', strtotime($bh['start'][$i])); ?> - <?php echo date('h:i A', strtotime($bh['end'][$i])); ?></span>
Next we need to change the path to call the child theme widgets/widget-openinghours.php file instead of the default.
Place a copy of /DT9/_directory/single-listing.php into your child theme directory (if the file doesn’t already exist).
Open the single-listing.php file and replace line #51:
<?php get_template_part( '_directory/widgets/widget', 'openinghours' ); ?>
<?php get_template_part( 'widgets/widget', 'openinghours' ); ?>
Those steps should change the display on the listings to a 12 hour format without altering any core files.
Note: Formatting can be changed where you see the date function with the settings like h:i A. Capital ‘H’ is the 24 hour format while small ‘h’ is 12 hour format. More formatting details can be found HERE.
Haven’t found a good way to handle the changes within the adding/editing listing form. That code is in the functions.php file.
Thank you jamesd but we dont be doing this. Beyond comfort level and I am on a deadline that is fast approaching. many thanks as usual though! mark:-)
@mark Ok, I gotcha.
Would it be any help if I put the edited files in a zip file where all you would need to do is unzip it, upload the contents directly into your child theme directory or would that not be ideal for your situation?
Note: The directories I mentioned, that would need to be created, would already be included. Uploading the contents would be the only thing to do. However, don’t forget as stated previously, this would only impact the actual listing page view hours, not the settings within the listings.
Build your WordPress Business today with our WordPress Business themes.