Home › Forums › Calendar Products › Events Calendar PRO › Events List – Duration Format
- This topic has 25 replies, 3 voices, and was last updated 10 years, 5 months ago by
Support Droid.
-
AuthorPosts
-
October 12, 2015 at 5:40 am #1013596
Lara
ParticipantI am using the Pro Events List shortcode and would like the Duration to only show the dates in the following format: October 12 – 16, 2015. How do I modify this? I’ve already done some customization to the way the shortcode shows my events, but I don’t know where to change this. Can it be done? Thanks!
October 12, 2015 at 8:40 am #1013710Geoff
MemberHey Lara–nice to see you again. 🙂
I’ve done this one other time before and–though it turned out to be quite a beast–adding this to the functions.php file seemed to do the trick.
That changes the date format so that it follows M D – D, Y when a multi-day event is taking place.
I hope this helps!
Geoff
October 12, 2015 at 9:09 am #1013725Lara
ParticipantGreat, thanks! I will give that a try. Also, on the events listing page, what file can I modify to get the location to show?
October 12, 2015 at 9:52 am #1013740Geoff
MemberGood question–are you looking to modify a specific view? You can find the templates for any of the calendar views in /the-events-calendar/src/views. You’ll notice there are subfolders from there from where you can get to specific views, like List View or Month View.
If you’re looking to modify one of the PRO views instead, you can find those in the events-pro plugin folder instead: /src/views/pro/.
Oh, and if you haven’t checked it out already, I’d highly suggest looking over our Themer’s Guide because it provides thorough instructions on how to override templates instead of altering them in the plugin folder–excellent to make sure your work is properly saved. 🙂
Geoff
October 12, 2015 at 10:31 am #1013753Lara
ParticipantIt is the pro photo view I believe. I have been looking through the Themer’s Guide, but will have to make sure I’ve added to the right template. Thanks so much for your help!
October 12, 2015 at 10:54 am #1013761Lara
ParticipantIf I want the Duration to always show the year, can I remove the $format = $date_without_year_format; argument? Also, I forgot to mention I need to remove the start time and end time. Can I just modify what you sent me earlier to accomplish this? Thanks!
October 12, 2015 at 11:08 am #1013768Geoff
MemberYeah, you can totally edit what I provided and remove the start and end times. There’s another filter you can use to remove those as well, which might be a little more manageable. 🙂
Geoff
October 12, 2015 at 12:58 pm #1013800Lara
ParticipantThanks again Geoff!
October 12, 2015 at 1:59 pm #1013839Lara
ParticipantI’m still not seeing any information about adding the location to the pro photo single-event listing. I’ve gotten the location to show with the pro list shortcode, but cannot seem to get it to work for the other. I have copied the photo/single-event.php to my child theme.
I’ve also gotten the year to show up for the dates when there is a date range for the event, but not when it is a single day. Am I missing something in that filter?
October 13, 2015 at 6:51 am #1014051Geoff
MemberHi Lara!
Just to confirm, is the template override for photo/single-event.php placed in the following folder in your theme: /tribe-events/pro/photo/single-event.php
I only ask because I’ve made the mistake of not creating a pro folder many times myself and just want to rule that here as well. 🙂
If it is located correctly, what function are you using to call the location and what info are you trying to display? For example to show the city and state, you could use something like:
<?php echo tribe_get_city() . ', ' .tribe_get_state(); ?>…or, if you want to show the full venue information: tribe_get_venue()
I’ve also gotten the year to show up for the dates when there is a date range for the event, but not when it is a single day.
Yeah, that filter is specifically for multi-day events. It will take some additional wrangling to apply the format to single-day events as well. In other words, you’re not missing anything–it just needs to be taken further. 🙂
Cheers!
GeoffOctober 13, 2015 at 7:33 am #1014107Lara
ParticipantHi Geoff-
I do have the file in the proper folder per your last note. I will need it to show the city and either state/region (can you make that state written out as opposed to the abbreviation in that same snippet or would that be a function?)
If you could give me some direction for the single day events as well that would be great! Thanks!
October 13, 2015 at 8:16 am #1014139Geoff
MemberHi Lara!
I do have the file in the proper folder per your last note.
Hmm, I just tried adding the code I provided to that same template and it seems to work. Perhaps try placing on the line right after this one (Line 44 for me):
<?php echo tribe_events_event_schedule_details(); ?>For the date format, you’ll want to revise the $microformatStartFormat and $microformatEndFormat variables that are defined toward the beginning the snippet so that the tribe_get_start_date() and tribe_get_end_date() functions conform to the date formats you’re looking for.
October 13, 2015 at 8:42 am #1014159Lara
ParticipantGot it! I just need to work on the date format and having the state spelled out. Thanks 🙂
October 13, 2015 at 12:09 pm #1014236Geoff
MemberMy pleasure! Keep me posted for sure. 🙂
October 14, 2015 at 6:58 am #1014490Lara
ParticipantGeoff-
I’ve added this code to my single-event.php page: <?php echo tribe_get_city() . ‘, ‘ .tribe_get_state(); ?>
It works great! Can I add ‘, ‘ .tribe_get_region(); to make it show the region too?
-
AuthorPosts
- The topic ‘Events List – Duration Format’ is closed to new replies.
