Support

Home Forums Recurring Events Manager Add-on 24 hour format in recurring events table with dropdown

24 hour format in recurring events table with dropdown

Posted: December 15, 2013 at 10:24 am


Joy Smith

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
Deborah

Online, but in maintenance mode.
New Install, Event Espresso version 3.1.36.1.P
WordPress version WP 3.8
Installed plugins
BackWPup by Inpsyde GmbH version 3.0.13,
Better WP Security by iThemes version 3.6.2,
Contact Form 7 by Takayuki Miyoshi version 3.6,
Event Espresso – Calendar by Event Espresso version 2.0.6.3,
Event Espresso – Custom Template Display by Event Espresso version 1.0,
Event Espresso – MailChimp Integration by version 1.2,
Event Espresso – Members Addon by Event Espresso version 1.9.8.p,
Event Espresso – Recurring Events by Event Espresso version 1.1.8.p,
Event Espresso Template – Recurring Events Table w/ Dropdowns by Event Espresso version 1.0,
Event Espresso – Ticketing by Event Espresso version 2.1.p,
Event Espresso by Event Espresso version 3.1.36.1.P,
MailChimp for WordPress Lite by Danny van Kooten version 1.4.8,
Really Simple CAPTCHA by Takayuki Miyoshi version 1.7,
Seamless Donations by allendav version 2.6.0,
WP Maintenance Mode by Frank Bültge version 1.8.11,
WPtouch Mobile Plugin by BraveNewCode Inc. version 3.1.3

  • This topic was modified 10 years, 4 months ago by  Joy Smith.


Dean

December 16, 2013 at 1:34 am

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?


Joy Smith

December 16, 2013 at 7:30 am

Yep – http://www.papillon-center.org/programs/adult-bereavement/


Tony

  • Support Staff

December 16, 2013 at 9:29 am

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>


Joy Smith

December 16, 2013 at 10:11 am

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!
Debbie


Josh

  • Support Staff

December 16, 2013 at 3:24 pm

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.


Joy Smith

December 16, 2013 at 4:30 pm

Thank you Josh, I’ll give that a try.

Happy Holidays!


Joy Smith

December 16, 2013 at 6:08 pm

Little problem implementing… Can you be a little more specific about which portion of the file to copy into my snippet plug-in?
i.e. the first line and the last line 🙂

Much appreciated!


Josh

  • Support Staff

December 17, 2013 at 7:50 am

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.


Joy Smith

December 17, 2013 at 9:05 am

Code copied and pasted with start time edit. Also renamed so that it starts first. However, triggered a fatal error:
Fatal error: Cannot redeclare espresso_recurring_dropdown() (previously declared in /home/papillon/public_html/programs/wp-content/plugins/espresso-template-recurring-dropdown/index.php:33) in /home/papillon/public_html/programs/wp-content/plugins/papillon-function-snippets/papillon-function-snippets.php on line 188

Line 188 is the closing bracket. To be clear, these are the last lines in the code:
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php
echo '<script>jQuery(".dropdown-menu").appendTo("body");</script>';

}

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. 🙂


Josh

  • Support Staff

December 17, 2013 at 9:16 am

You can rename the snippet plugin’s folder to something like a-papillon-function-snippets so it loads before the recurring template plugin.


Joy Smith

December 17, 2013 at 4:14 pm

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…


Josh

  • Support Staff

December 17, 2013 at 5:02 pm

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);
  • This reply was modified 10 years, 4 months ago by  Josh. Reason: code formatting


Joy Smith

December 17, 2013 at 9:04 pm

Thanks Josh – that looks like the one.


Joy Smith

December 17, 2013 at 9:39 pm

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.


Josh

  • Support Staff

December 18, 2013 at 7:26 am

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.


Joy Smith

December 18, 2013 at 10:16 am

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.

Event Espresso