Posted: December 15, 2013 at 10:24 am
|
Hi – After a couple of days of customizing and manipulating settings and searching the forums, I’ve whittled my question list down. All my questions have to do with recurring events. First post/question: I have the recurring events table with dropdown add on. The event start time in the dropdown table is displaying as a 24 hour format. The Time Format in WP general settings is set on a 12 hour clock and the Time and Date Settings in EE Gen. Settings reflects that: December 15, 2013 9:22 am. The 12 hour format displays everywhere else – in the event overview, and in the actual event listing on the registration page after the date is selected. I have made fruitless attempts getting into the code. Seems this should be pulling the correct format with everything else. Am I missing a setting somewhere? Thank you Online, but in maintenance mode.
|
|
Hi, The plugin should be picking up on the default WordPress date format, my tests locally show that this is the case. Can you provide a link to an example page showing this issue please? |
|
Yep – http://www.papillon-center.org/programs/adult-bereavement/ |
Hi Joy, In order for the time to display in a different format you’ll need to edit the template. If you open up espresso-template-recurring-dropdown/index.php go to line 124 you’ll see: <td id="start_time-<?php echo $first_event_instance['start_time']?>" class="start_time"><?php echo stripslashes_deep($first_event_instance['start_time'])?></td> Change it to: <td id="start_time-<?php echo $first_event_instance['start_time']?>" class="start_time"><?php echo event_date_display($first_event_instance['start_time'], get_option('time_format'))?></td> |
|
|
Thank you very much, that did the trick. 🙂 I had to edit the file in the original location, though, because it didn’t pick up the edit when I copied it to upload/espresso/templates. Since the file is just index.php, that makes sense – I thought maybe copying the whole recurring dropdown folder would work, but it didn’t. Other than backing up the original file, which is what I did, is there a better way since I’m assuming an update will overwrite that change? Thanks! |
Hi Joy, It turns out since the recurring events table plugin checks to see if the espresso_recurring_dropdown function already exists: if (!function_exists('espresso_recurring_dropdown')) { [...] } You can copy the entire modified espresso_recurring_dropdown() function into your theme’s functions.php file or into a custom snippet plugin. |
|
|
Thank you Josh, I’ll give that a try. Happy Holidays! |
|
Little problem implementing… Can you be a little more specific about which portion of the file to copy into my snippet plug-in? Much appreciated! |
Starting with line 32: function espresso_recurring_dropdown(){ ending with line 209: } Another reason it may not be working is if your custom plugin loads later than the recurring events dropdown plugin, your custom function will not execute. WordPress will typically load up plugins in A-Z order, so you can give your custom snippets plugin a name starting with any letter between A and D to ensure it loads before the other plugin. |
|
|
Code copied and pasted with start time edit. Also renamed so that it starts first. However, triggered a fatal error: Line 188 is the closing bracket. To be clear, these are the last lines in the code: } Maybe there is a step I missed? Obviously it doesn’t like the function existing in both places… Sorry, I thought this would be a simple fix. 🙂 |
You can rename the snippet plugin’s folder to something like a-papillon-function-snippets so it loads before the recurring template plugin. |
|
|
I’m afraid that didn’t work. I also renamed the file itself: plugins/a-papillon-function-snippets/a-papillon-function-snippets.php on line 188. Same error, cannot redeclare… |
There’s an action hook that loads the espresso_recurring_dropdown function. This will let you remove that function from the action. What you can do is add a few lines of code to your custom snippets plugin -and- change the name of your custom function. Here is some example code: add_action('action_hook_espresso_custom_template_recurring-dropdown','my_espresso_recurring_dropdown', 9, 1); function my_espresso_recurring_dropdown(){ remove_action('action_hook_espresso_custom_template_recurring-dropdown','espresso_recurring_dropdown', 10, 1);
|
|
|
Thanks Josh – that looks like the one. |
|
It’s so close – I can taste it. The snippet works now, except now I have two drop down events tables – the first with 12 hour format and the second with 24. 🙂 And apparently the select a date button doesn’t work. I think that’s because of the duplicate and I wonder if it’s in the .appendTo(“body”) script at the end? If that’s true, then like the remove action you mentioned above, can the .appendTo from the original file be pulled via this file? If that’s what it is. |
Hi Joy, It turns out that the original code snippet I posted had a few errors. The formatting got all messed up and I tried to fix it. I’ve also moved the remove_action inside the function and changed the priority so it should remove the original function from the code execution. Please note that you’ll need to copy the js and css folders into your new plugin as well. |
|
|
Winner, winner… 🙂 That’s the one, Josh. Thank you very much for all your help. Happy Holidays! |
The support post ‘24 hour format in recurring events table with dropdown’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.