Home › Forums › Calendar Products › Events Calendar PRO › Separate Date and Time in events-advanced-list-load-widget-display.php File
- This topic has 11 replies, 5 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
April 26, 2012 at 12:48 pm #18324JimParticipant
In the events-advanced-list-load-widget-display.php file is there a way to separate the date and time into separate HTML elements, rather than displaying as one element? I figured out how to remove the time by using $displayTime = false in the tribe_get_start_date(); function, but can’t figure out how to remove the date so that each element can be echoed into it’s own element. Am I thinking about this the wrong way? Any help would be greatly appreciated.
April 26, 2012 at 3:37 pm #18343RobMemberHi there Jim. Thanks for reaching out. Are you saying you want these to be displayed separate from one another within the widget, or that you just want to remove the date but keep the time? If you can provide a bit more elaboration (my apologies for having to ask) on what you want to do, I can bring in a dev on our end to take a look.
April 26, 2012 at 3:51 pm #18345HenryMemberYou can echo the time and date separately easily enough. To echo the start time for example you could use this:
echo tribe_get_start_date(null, false, ‘g:iA’);
Then to echo the start date you could use this:
echo tribe_get_start_date(null, false, ‘l j F Y’);April 26, 2012 at 4:47 pm #18347JimParticipant@Rob La Gatta: Thanks for the quick response! Yes, I’d like to be able to display these items separately for styling purposes (I don’t know if I can type HTML in this forum but I’d like to basically do something like, “05-0312:30pm”. Basically what I’m doing is this: I’ve created a widgetized sidebar for my client for easier customization on his end in which I’d like to list the events, but the options in the sidebar only allow you to show or hide the date and time together, not separately. That said, I figure that modifying the code that will be displayed in the sidebar (wp-content/themes/plugins/events-calendar-pro/views/events-advanced-list-load-widget-display.php) is the best way to approach this. However, being a front-end developer with limited knowledge of programming, I’m struggling with this. Thanks!
@Henry: Thanks for the quick response! I have to admit my ignorance here and say that I’m not sure how to use those functions and where they should go. I messed around with them in the wp-content/themes/plugins/events-calendar-pro/views/events-advanced-list-load-widget-display.php file but it broke every time I changed something. Hopefully I made myself more clear above. Can you explain how to use those in a little more detail? Thanks!April 30, 2012 at 7:58 am #18427RobMemberThanks, Jim. Just wanted to give you a heads up that I’m talking this over with the dev team and should be able to get you some guidance on it by the afternoon. Stay tuned and thanks for being patient thus far.
April 30, 2012 at 8:48 am #18436JimParticipantThanks Rob. I just realized that the HTML I typed didn’t come through so hopefully you understand what I’m trying to explain. Let me know if you need any more clarification.
April 30, 2012 at 6:59 pm #18464RobMemberGotcha. Thanks, Jim – I think I understand the issue here, but as this is a bit outside my area of expertise, I’ve asked Jonah from our dev team to take a look and respond directly. Expect to hear from him shortly…and if he isn’t sure I can run it up the flagpole until we’ve got you something substantive here.
May 1, 2012 at 7:21 am #18476HenryMember@Jim
They have to be wrapped in php tags so the browser knows to treat them as php code. See an example here:
http://pastebin.com/K2HcPXjGHope this helps.
May 1, 2012 at 9:47 pm #18538JonahParticipantHey Jim,
Like Henry pointed out those tags do need to be wrapped in PHP tags but let me elaborate a little more…
The tribe_get_start_date() function can be used as many times as you to spit out whatever you want about the start date/time for an event. By default the function is going to use your date/time display format in Settings > General, but you can easily override this. All you need to do is pass in parameters to trim down what particular date/time information is being displayed for each instance. The function accepts standard PHP date format parameters to determine the format. It may help to take a look at those: http://php.net/manual/en/function.date.php
So, let’s say you only wanted the first part to display the month on line 46. Just change line 46 to read:
echo tribe_get_start_date( $post->ID, $start, 'M' );
Or you could change it to display the full month name:
echo tribe_get_start_date( $post->ID, $start, 'F' );
Then, if you wanted to display the time chunk, just either add another div outside of the div with the class of “when” or add it within and it doesn’t need to be a div, it could be any html element. Maybe try a span first.So, right below line 46 you could add: http://pastie.org/private/hagxmeraymgojaegxfw8a
And that will give you a span tag with the time inside that you can style via the event-time class in your CSS.
Let us know how it goes. I hope that helps!
May 2, 2012 at 10:30 am #18558JimParticipantOk, that did the trick! Thanks so much everyone for the help! I really appreciate it!
May 2, 2012 at 11:53 am #18570JonahParticipantGlad to hear Jim, let us know if there’s anything we can do!
– Jonah
July 7, 2015 at 6:19 am #976705Support DroidKeymasterThis 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 ‘Separate Date and Time in events-advanced-list-load-widget-display.php File’ is closed to new replies.