Events Made Easy › Forums › How do I … › Use short code instead of a widget
Tagged: short codes
- This topic has 11 replies, 2 voices, and was last updated 12 years ago by Franky.
-
AuthorPosts
-
Wed 14 Nov 2012 at 18:37 #43868AnonymousInactive
Hello Franky,
Sorry to trouble you.
Is it possible to use a short code instead of a widget?
This is the code that I use in the widget:
<table class=”ShortCourseListing”> <thead> <tr> <th>Centre</th><th>Course Dates</th><th>Assessment Date</th><th>Assessment Location</th></tr></thead><tbody>
<tr><td>
#_LOCATION</td><td>
#_{j M Y} [events_if tag=”#ESC_{j M Y}” notvalue=”#ESC@_{j M Y}”] #@_{- j M Y} [/events_if]</td>
<td>#_ATT{assessment_date}</td><td>#_ATT{assessment_location}
</td></tr>
</tbody></table>
Many thanks for your time.
Wed 14 Nov 2012 at 23:00 #50004FrankyKeymasterDo you mean “shortcode inside a widget”? Yes, that’s possible, see the EME settings (search for widget).
Wed 14 Nov 2012 at 23:02 #50005AnonymousInactiveHi Franky,
No – Can I use the above short code without using it in a widget.
Thu 15 Nov 2012 at 10:28 #50006AnonymousInactiveOr better still can I do it using php in my template?
Thu 15 Nov 2012 at 13:20 #50007FrankyKeymasterIf using this directly in php, you need to call a EME function to interpret it all, otherwise you have nothing. Look at calling eme_replace_placeholders() directly (with the correct parameters: format, event)
Thu 15 Nov 2012 at 20:07 #50008AnonymousInactiveHello Franky,
I managed to get it working using this as the short code
<table class=”ShortCourseListing”><tr><th>Centre</th><th>Course Dates</th><th>Assessment Date</th><th>Assessment Location</th></tr>[events_list category=12 limit=0 format="<tr><td>#_LOCATION</td><td>#_{j M Y} -#ESC@_{j M Y}</td><td>#_ATT{assessment_date}</td><td>#_ATT{assessment_location}"]</td></tr></table>
But, if I have an event on a single day it shows the same date twice.
In my widget code I use the following between my td tags
#_{j M Y} [events_if tag="#ESC_{j M Y}" notvalue="#ESC@_{j M Y}"] #@_{- j M Y} [/events_if]
When I use this coding in my short code it throws everything out?
How can I use the short code to remove the duplicate date if the event is only on one day?
Many thanks in advance.
Fri 16 Nov 2012 at 19:54 #50009FrankyKeymasterI think I’m a bit confused here. Where exactly are you typing this in?
Fri 16 Nov 2012 at 19:58 #50010AnonymousInactiveOn a page
Fri 16 Nov 2012 at 20:02 #50011FrankyKeymasterDirectly in a page? There the conditional tag is not supported … it only works correctly in the format settings of EME.
Fri 16 Nov 2012 at 20:07 #50012AnonymousInactiveI was originally using a widget to put the codes on different pages, but to save time (as I have lots of categories, I thought it might be easier to use short code (copy and paste) and just change the category id for each page. Everything works okay except when I have an event on a single day – it shows the start date and then a duplicate date as the end date. The code (above) works okay if its in a widget, but doesn’t work if used on a page.
Fri 16 Nov 2012 at 20:12 #50013AnonymousInactiveIf I put this code in a widget it works okay on a page
#_{j M Y} [events_if tag=”#ESC_{j M Y}” notvalue=”#ESC@_{j M Y}”] #@_{- j M Y} [/events_if]
So would it work if I ceated a template for each category using php coding?
Sat 17 Nov 2012 at 12:47 #50014FrankyKeymasterif using php coding, why not just use php to compare date/time values of beginning and end?
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.