Home › Forums › Calendar Products › Events Calendar PRO › Changing Date Format in v3
- This topic has 15 replies, 3 voices, and was last updated 10 years, 9 months ago by Neill.
-
AuthorPosts
-
July 8, 2013 at 3:43 pm #53895leviticusParticipant
How do I change the date formatting on single event posts? Right now it is displaying as “October 13” under the main event title and I would like to change it to say “Sunday, October 13, 2013” instead.
July 8, 2013 at 7:43 pm #53931NeillMemberHi Genesis,
Thanks for your question.
The Event Calendar takes its date format from what you would have set in the main WordPress settings. You can get there by going to Settings -> General and the option you are looking for looks like this: http://d.pr/i/6C3J
Hope that helps.
July 8, 2013 at 7:44 pm #53932NeillMemberJust a word of caution. Changing this setting here will change the way the date is formatted site wide, not just in The Event Calendar plugin.
July 10, 2013 at 11:49 am #54325leviticusParticipantThanks neillmcshea for the quick response. I do have the date/time settings in WordPress as the first option (July 9, 2013), but the year still doesn\’t show on the event post. http://www.formannd.com/event/trinity-church-turkey-dinner/
Is there any way to add the “Sunday” just on single event posts?
July 11, 2013 at 2:45 pm #54629NeillMemberHi Genesis,
I can see the issue now in the link you provided. Have you made any changes to the plugin since the 3.0 update? Also it might be a good idea to try switching to a default theme like twenty twelve to test and see if there is a conflict with the theme you are currently using and the plugin. I’d also disable each of you plugins one by one and see if any of those are causing an issue. Once you’ve done that and ruled out that none of those things are causing the problem we can dig a little deeper.
July 16, 2013 at 10:18 am #55465leviticusParticipantI switched to the default theme and deactivated other plugins and did not see a change in the date.
I haven’t made any changes to the core plugin itself. I did make template files as described in the 2.0 Theme Builders Guide before the upgrade to 3.0. I could go and make new template files for all the views using my previous date format code, but if there was a more elegant solution that would be plugin-wide, that would be preferable.
July 17, 2013 at 9:11 am #55708leviticusParticipantI did notice something that may indicate that it is the Events plugin code causing the “2013” to be removed from the date line. As you can see from http://www.formannd.com/events/upcoming/?action=tribe_list&tribe_paged=2 the “2014” does appear on events happening next year but “2013” doesn’t appear on events happening this year. Is there a way to turn 2013 on in the date or will I have to create all new template files?
July 17, 2013 at 4:05 pm #55780smallmammothdesignParticipantHi,
I have the same question, only the modifications I’d like to make are more extensive (e.g., having the date output in this order, without the @ symbol: 8AM – 9:30AM, JULY 17, 2013). I would like this change to appear throughout all the Events Calendar pages.I have already made these changes to the general.php file found in Public > Template Tags, so I’m fine on that count.
However, rather than making them directly to the general.php file, I’d rather deregister the tribe_events_event_schedule_details function in my theme functions, and reregister the new version I’ve made, so the change isn’t lost upon update.
From what I’ve read, this involves adding this line of code to my theme’s functions.php:
remove_action( $tag, ‘tribe_events_event_schedule_details’, $priority, );However, I can’t identify the $tag hook and the priority. Could you please tell me what they should be?
And then, to re-register the new function using the same name (tribe_events_event_schedule_details), can I just paste the (modified with my changes) function in as is? I’d rather not rename it, to avoid having to update the call in all the templates that use it.
July 18, 2013 at 1:29 pm #55934NeillMemberHi Genesis,
I’ve just dug a little and it appears that in the update to 3.0 we have removed the functions to display the year, if it is the current year. So all 2013 events will not display 2013, but 2014 will as its next year. Likewise in 2014 the year 2014 will not display as it will then be the current year.
The idea behind this is to make the events look a little more human and less “generated by a machine”. I can understand that you might want to add that year back in. So incase you do.
In the file: public/template-tags/general.php there is some code that deals with the conditioning of the date. Its on line 781 and looks like what I have here in this pastebin: http://pastebin.com/yr9q1vQ2
Changing the format here of the line here:
$format = 'F j';
should give you the desired result. You could also go an try play with the format of the filter itself via $tag, ‘tribe_events_event_schedule_details’, and rebuild the output, any way you wish.@samllmammothdesign – Have you looked through our docs URL: http://docs.tri.be/Events-Calendar-PRO/ it should have all the info you need to point you in the right direction. If not, as your issue is a little more in-depth, maybe you could start a new thread with a little more detail about the new function you are trying to re-register including some info on the modified changes. Including a pastebin or gist of the code with comments can be really helpful as we may be able to turn to the devs on our team and ask for there input.
July 18, 2013 at 1:57 pm #55938smallmammothdesignParticipantHi Neil,
Thank you for your answer. I’ll start a new thread if it turns out to be necessary, but I think you misunderstood my question, because the solution you have offered Genesis is exactly the solution I am looking for.I’ve already modified general.php as you are suggesting Genesis do (what exactly I have changed is not pertinent — as I said before, I’ve already worked that out).
However, and Genesis should know this too, if s/he later updates the plugin, the change to general.php you are recommending will be lost, because general.php is not an over-ridable file, right?
So, to avoid losing the changes on update, I would like to use the second approach you are suggesting to Genesis: “play with the format of the filter itself via $tag, ‘tribe_events_event_schedule_details’, and rebuild the output, any way you wish.”
Could you be a bit more specific on how to do this? NOT on how to rebuild the output. Again, I’ve done that aLready. My questions are:
— What goes in place of $tag?
— What code goes before/around $tag, ‘tribe_events_event_schedule_details’?
— before playing with $tag, ‘tribe_events_event_schedule_details’ as you are suggesting, don’t I have to deregister the original function or filter or whatever it is?Thanks for your help.
July 18, 2013 at 2:55 pm #55971NeillMemberHi Smallmammothdesign.
Thanks for your reply. I thought your query was on the same lines and had a hunch this might point you in the right direction but I got the impression there was a little more complexity to the modified changes that would require a little more attention. Thanks for clarifying that.
We are experiencing really high support traffic at the moment and as such we are prioritizing support issues over customization. That being said we are not ignoring you but your request is a little more customization then a bug, so we can take a closer look at this when the load dies down. Also keep an sharp eye on our support docs, we are updating them regularly and should have more information that might be of use over the next few days.
Thanks again for your patience with this, and if you are able to bare with us a little while longer we can get back to you when the bug related support dies down.
Neill
July 18, 2013 at 8:19 pm #56037smallmammothdesignParticipantI appreciate that bugs take precedence.
That said, I have a deadline, and hope I won’t have to wait more than a week for an answer!
Thanks.July 19, 2013 at 1:21 pm #56146leviticusParticipantThanks Neil and smallmammoth for the new information. I too would really appreciate a tutorial on how to non-destructively override/modify plugin functions such as ‘tribe_events_event_schedule_details’. I think that would provide the best plugin-wide solution. Let me know if that turns into a new thread.
For the single event date modifications, I think I will just make a new template for that instance.
July 23, 2013 at 1:13 pm #56633NeillMemberHi Genesis and smallmammothdesign,
We’ve had a little more time to look at this now and a developer I worked with has come up with a few solutions that are update safe.
So the first way is not to use the deregister/register method. You can achieve what you need by simply overriding single-events.php. You can do this by placing a copy of the file in YOURTHEME/tribe-events/single-event.php. This new copy will override the plugins copy. In the overriding copy of the file you can then remove: and since you already have your code ready to use you can add what you need in here.
If you still want to use the hooks method, you can use: tribe_events_event_schedule_details as a filter. Discussing this with the developer, you don’t have to deregister anything in this case.
Both these options are update safe.
Hope that gets you guys on the right path. Let us know how it works out and thanks again for your patience.
Neill
July 23, 2013 at 2:34 pm #56673smallmammothdesignParticipantThanks for following up on this. In my case, overriding single-events is not enough, because I want the change to appear on all pages and templates. And when I tried simply using tribe_events_event_schedule_details, it did not override the existing filter.
For anyone else trying to do this, here’s what I ended up doing in detail:
I copied tribe_events_event_schedule_details, including all the subsequent bits that define the date format into my theme’s functions.php. I then renamed it tribe_events_event_schedule_details-2, and adjusted the variables to my liking.I then had to change tribe_events_event_schedule_details to tribe_events_event_schedule_details-2 in all the templates I used (first placing the templates in the tribe-events override folder in my theme folder). Tracking them all down is a bit of a nuisance, but it worked.
Options for setting the date format might be a nice feature to include in a future update — not everyone wants things like ‘@’ before the time.
-
AuthorPosts
- The topic ‘Changing Date Format in v3’ is closed to new replies.