Home › Forums › Calendar Products › Community Events › Show Year on Event Page Even if Event in Current Year
- This topic has 4 replies, 3 voices, and was last updated 10 years, 6 months ago by
Support Droid.
-
AuthorPosts
-
October 21, 2015 at 6:45 am #1016507
Josh
ParticipantHello,
I would like to show the year on event pages for events that start and end in the current year. Currently, I see two ways to do this and neither is ideal. The first is to change the Date Format Settings for Date without year to “F j, Y” to force the year to show up. This is not ideal because it affects the global setting.
The second way is to comment out the following lines in the plugin source code:
// if it starts and ends in the current year then there is no need to display the year if ( tribe_get_start_date( $event, false, 'Y' ) === date( 'Y' ) && tribe_get_end_date( $event, false, 'Y' ) === date( 'Y' ) ) { $format = $date_without_year_format; }This code is very presumptuous given the statement “there is no need to display the year”. Some users might feel otherwise. Of course, commenting it out is not ideal because the change could break with an update.
Is there another way to change this setting?
Thanks.
October 21, 2015 at 1:58 pm #1016713Nico
MemberHi Josh,
Thanks for reaching out. I’ll help you with this one!
So not sure why changing the setting for ‘Date without year’ won’t work for you, it seems to be the same as commenting the lines in the plugin. Are you looking to change this just for single events? If that’s the case you can do a template override of the single event template and replace the function call for some custom code in the template. You can check the details for that on our Themer’s guide.
Please let me know if this solution makes sense and if you need more details on how to achieve the override,
Best,
NicoOctober 23, 2015 at 6:51 am #1017231Josh
ParticipantThe reason I would prefer not to change the “Date without year” setting is because it affects a global value. I wouldn’t know what other templates refer to that value, and in some of those cases, maybe I would want not to show the year. I am effectively abusing that field, because I am putting a year value in the format described as “without year”.
It’s true, I could just change the single event template – I forgot about that :-/
I ended up changing the format, because I think it is likely that I want to show the year in all cases that the short format is used. However, it would be helpful to have a list of all templates that use the short form (i.e. without year if event is in current year). Can you provide such a list so I can spot-check them?
Thank you!
October 23, 2015 at 3:28 pm #1017499Nico
MemberHey Josh,
Thanks for confirming this, I guess that would be shown pretty much everywhere the event date is shown: all widgets, all main event views, single event views, etc. I don’t have such a list but you can search for all occurrences of the function ‘tribe_events_event_schedule_details’ in the plugin folder. I guess you are not abusing the field, it just the config for how the date of events taking place in the current year is shown. Maybe the label of the field ‘date without year’ seems to suggest the year shouldn’t be there, but that’s you call.
Please let me know if I can help you with anything else,
Best,
NicoNovember 7, 2015 at 6:05 am #1022823Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Show Year on Event Page Even if Event in Current Year’ is closed to new replies.
