Events Made Easy › Forums › How do I … › Conditionally Coding Stop Time to not Display
Tagged: conditional code
- This topic has 6 replies, 3 voices, and was last updated 10 years, 3 months ago by Franky.
-
AuthorPosts
-
Tue 29 Jul 2014 at 00:59 #52586AnonymousInactive
Hi there,
I love this plugin and have used it for quite awhile, though only with basic features.
I am now trying to code the following for my Events List page as well as the widget and the Event Details page: Conditional code to display the start and end of multi-date events, when applicable, PLUS code to NOT include an end time, when applicable (and I am not referring to all day events). My goal is to have it appear as:
Event Name
Event Date or Dates(as applicable)
Event Start Time – Event End Time(when applicable — some events just don’t have end times)
AddressI have exhaustively searched the forums, reviewed the documentation and have come up with the following code:
<dt>#_LINKEDNAME</dt> <dd>#F #j, #Y[events_if tag="#ESC_{F j Y}" notvalue="#ESC@_{F j Y}"] through #@_{- F j Y}[/events_if]<br /> #g:#i#a[events_if tag="#ESC_{g: i a}" notvalue="#ESC@_{g: i a}"] #@_{- g: i a}[/events_if]<br /> #_ADDRESS</dd>
I have also tried a bunch of code permutations for the event times line of code.
The display of multiple day events is working just fine, but not so with the time data.
The plugin (I have the most current version) will not allow me to leave the End Time field blank for an event, and it will not allow me to enter 00:00 (which I could use in the conditional code). When I delete the data in the field, it reverts to 12:00am.When I enter a start and end time that are identical, the plugin automatically changes the event end date to the subsequent day.
So, how to tame this gnarly beast? I am not a coder and will really appreciate any help offered.
Many thanks in advance!
Tue 29 Jul 2014 at 03:28 #52588AnonymousInactiveTry (For 2nd & 3rd lines of code):
#_LINKEDNAME
#_{F j, Y}[eme_if tag="#ESC_{F j Y}" notvalue="#ESC@_{F j Y}"] through #@_{F j, Y}[/eme_if]
#_{g:ia}[eme_if tag="#ESC_{g i a}" notvalue="#ESC@_{g i a}"] – #@_{g:ia}[/eme_if]
#_ADDRESSFor some more ideas, here is some code from my site:
#_{M j}[eme_if tag="#ESC_{M j Y}" notvalue="#ESC@_{M j Y}"] – [eme_if2 tag="#ESC_{M}" notvalue="#ESC@_{M}"]#@_{M }[/eme_if2]#@_{j}[/eme_if]For multiple day event that spans from one month into the next, this produces : July 28 – August 1
For multiple day event that occurs within a month, it produces: July 28 – 31It drops naming the month a second time if it is the same.
Tue 29 Jul 2014 at 15:58 #52590AnonymousInactiveThanks @danbru1989 for the input, but sorry to say that did not work.
For the event that happens on a single day and has no end time, the following occurs: If I enter the same end date as start date, make the Start time 12:00pm and delete any time in the End Time, the plugin makes the End time 12:00am.
When I enter 12:00pm in the Start and End times, the plugin makes it a multi-day event ending on the next day.Any other thoughts on what would work? Also has “events_if” replaced “eme_if” or are both usable?
Thanks!Tue 29 Jul 2014 at 17:43 #52591FrankyKeymasterHi, this is confirmed as a bug and fixed here (so the end time can be the same as the start time when updating an event too):
Tue 29 Jul 2014 at 20:32 #52592AnonymousInactiveThanks, Franky!
In the meantime, I discovered a workaround and I will post it here so others can use it for their own purposes!
My final code for the Event List display:
<dt>#_LINKEDNAME</dt> <dd>#F #j, #Y[events_if tag="#ESC_{F j, Y}" notvalue="#ESC@_{F j, Y}"] through #@_{F j, Y}[/events_if]<br /> #_ATT{altHours}{#g:#i#a - #@g:#@i#@a}<br /> #_ADDRESS</dd>
So, I created a custom attribute called “altHours” (3rd line of code) and in any event’s Edit page I can assign it any value I choose, which means I can assign, e.g., “Starts at 11:30” as a value. When this custom attribute does not have a value assigned to it (in an event’s detail page), the last half of line 3 code:
{#g:#i#a - #@g:#@i#@a}
displays. Yay!Giving credit to where it’s due, I got this tidbit on a writeup giving tips and tricks about the Events Made Easy plugin:
Easy Events-Made_Easy Tricks.Hope this helps! Such a nice, robust plugin!
Fri 1 Aug 2014 at 13:47 #52596AnonymousInactiveAh yes… a bug. Makes sense now.
Events on my site only deal with dates and the code works great. With the bug fix, you should find the code works for properly displaying time of day too.
My understanding is that “eme_if” replaced “events_if”.
http://www.e-dynamics.be/wordpress/?cat=24Fri 1 Aug 2014 at 14:19 #52597FrankyKeymasterYes it does 🙂
And the bug was for updating an event, not for creating it (that’s why it escaped my testing). -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.