Support

Home Forums Event Espresso Premium Goes on sale Date format

Goes on sale Date format

Posted: August 30, 2015 at 8:26 pm


Jade

August 30, 2015 at 8:26 pm

The date for ‘Goes on Sale’ in the ticket selector is not following the format in WordPress settings.

How do I change this particular date string?

See this link http://dev.southgatemelbourne.com.au/events/st-vincent/


Dean

August 31, 2015 at 6:47 am

Hi,

Currently the only way to amend that date format is via a small function.

The following can be added to a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ ):

function gos($dformat) {
	$dformat = $dformat = 'l j F Y';
	return $dformat;
}
add_filter('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', 'gos');

The above should change it to match your format (e.g. Monday 31 August 2015).


Jade

August 31, 2015 at 5:09 pm

Hi Dean

Thanks for your response.

I’ve tried this with no luck unfortunately.

I put the following in our functions file (we maintain our own custom theme so don’t need to use plugins)

function goesonsale($dformat) {
$dformat = ‘l j F’;
return $dformat;
}
add_filter(‘FHEE__EED_Ticket_Selector__display_ticket_selector__date_format’, ‘goesonsale’);

Is there anything I’m missing?

Thanks


Dean

September 1, 2015 at 5:04 am

Hi,

Nope, nothing else needed. I tested with the Twenty Twelve default theme and it worked fine.

You could check the code to make sure the quotation marks are correct (not curly ones) and that there is no obvious mistakes. Otherwise you could try the custom site plugin route. The code itself though is solid.


Jade

September 2, 2015 at 1:40 am

Hi Dean

I’ve typed it out rather than cut & paste and have tried the plugin approach to no avail.

I’ve managed to get other custom functions to work fine, eg removing the ical button. So I’m at a loss as to why this wouldn’t work…

http://dev.southgatemelbourne.com.au/events/st-vincent/


Dean

September 2, 2015 at 5:21 am

Hi,

OK, I should have thought of this earlier. The hook being used in the code is a fairly recent addition to the plugin and your dev site EE version is out of date. If you update to the latest version then it should work just fine from there.


Jade

September 2, 2015 at 11:04 pm

Hi Dean
I’ve upgraded to 4.8.7 on the dev site and it’s made no difference unfortunately. I have warnings that PHP is out of date, could this be affecting anything?

Thanks


Dean

September 3, 2015 at 6:02 am

It’s a possibility, you would have to check your sites error logs to see what’s happening and whether any errors from this function appear or not.


Dean

September 3, 2015 at 6:23 am

Actually, no.

It appears, and I’m really sorry about this, that we have been talking about different areas of the plugin.

The above code works, but only for the Ticket Details area (screenshot http://take.ms/5MNy1) not the actual ticket selector.

Currently there is no filter for the Goes on dale datetime in the area you are looking at. I will request the development team to add one in.


Jade

September 6, 2015 at 10:10 pm

Bummer! Well at least I know I’m not going crazy!

Thanks for placing the request.

In the meantime, is it possible to point me to where I could hack this in core code for a temporary fix?


Tony

  • Support Staff

September 7, 2015 at 7:56 am

Hi Jade,

Generally we do not provide support for core edits, however as this fix will be included within the next version of Event Espresso we can provide the code used.

Open up modules/ticket_selector/templates/ticket_selector_chart.template.php

Line 198 is this:

<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', 'M d, Y' ); ?></span>

Change that to:

<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', 'M d, Y' ) ); ?></span>

Then use a function like this:

function custom_ts_short_date($dformat) {
	
	$dformat = 'Y-m-d';
	return $dformat;
}
add_filter('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', 'custom_ts_short_date');

To alter the format used.

The reason you are adding a filter is because that filter will be added in the next version of EE, so when you update this will continue to work as expected. The next version of Event Espresso will use the date format set within the WordPress general settings, that filter allows you to use a shorthand version if you prefer.


Jade

September 8, 2015 at 3:42 am

Brilliant, thanks so much Tony!

Looks great http://www.southgatemelbourne.com.au/events/st-vincent/


Tony

  • Support Staff

September 8, 2015 at 5:08 am

You’re most welcome 🙂

Ill close this thread, please feel free to open up another if you have further problems.


Lorenzo Orlando Caum

  • Support Staff

September 12, 2015 at 3:47 pm

Hello, filters are now available that will allow you to customize the date formats in the ticket selector.

Thanks again!


Lorenzo

The support post ‘Goes on sale Date format’ 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