Posted: October 26, 2012 at 3:31 am
|
I have created a page for a venue (as I want it to appear as a main menu item and cannot see how to make venues a menu list) and want to list all of the events in that venue. [ESPRESSO_VENUE_EVENTS id=1] shows the following: As, in this case, all of my events are the same, I only want to list the dates. How can I create a [ESPRESSO_VENUE_EVENTS_DATES id=1] tag? |
|
Hello bins, You are right in what you have done by making a page for it so that you can add it to your menu. In terms of only showing the dates, that isn’t possible with the shortcode. You would either need to write a new shortcode based on the original, or possibly look to selectively hide the data you don’t need with CSS. |
|
Thanks, dean. Do you have a guide or pointer on how to edit/create new short codes? |
|
Hi Bins, Unfortunately no. The best I can advise is that the general shortcodes are in the shortcode.php file. It will require knowledge of PHP and some time to familiarise yourself with the different Event Espresso functions. It’s not really recommended to do unless you are comfortable coding. I was trying to think of alternative ways in which you could achieve what you are after but I am drawing a blank. |
|
Ok, thanks. Whilst not a php expert, I have been known to fiddle! |
|
It’s the best way to learn! Just remember to back things up, especially if you are working on a live server! |
|
You can do this with a few lines of code added to to the shortcode.php, event_list.php and event_list_display.php files. Not the best solution, but quick and easy. You will need to update all the files each time there’s a EE update. @Support |
|
@Tony, not at all, this is a community so feel free to chime in. |
|
As the short-code ESPRESSO_VENUE_EVENTS already grabs all the relevant details for what you need. You just need to filter out the bits you don’t. You can go through and remove it all with CSS as mentioned above. Or, add another attribute to that short-code (I’ve used show_only_dates as an example) set that to true when you want to show only dates, and then an if statement which if true displays one thing, in this case only the dates for the event, else show the usual details. Open up shortcodes.php, go to line 932. Your looking for:
Make a little space under it and add:
Save that, open event_list_display.php, at around line 40 you’ll see:
After the php closing tag (?>), paste something like this:
The code within the PHP tags checks if you only want the dates shown (venue_dates_only = true) for the event, and outputs the date. You can change the code in between to output whatever you like, this literally is just outputting the date for each event in that venue. At the very end of event_list_display.php you now need to paste: Save it. Test the short-code by adding show_only_dates=true like:
Because we just added an attribute and test to see if that attribute is set to true (only when we manually set it to true), this wont affect any of the other short-codes/display. I said previously you need to also edit event_list.php, you don’t. This isn’t the best solution, but is the quickest and easiest for you to apply yourself. If you prefer I’ll upload shortcodes.php and event_list_display.php and you can just place them in \wp-content\uploads\espresso\templates, but the code above is all that is needed. Also, dont forget this needs updating each time EE is updated. 3.1.28 is said to change a fair amount of HTML/CSS in the templates, shouldn’t really affect this too much, but something to remember. Appologese for the long post. |
|
I cant post php code. Never even thought about that. Here’s the codes on pastebin: Or the files already done. |
|
Hi Tony, I was going to reply to this asking you to send the code so I could repost it, but pastebin is even better. Thank you for posting it, it’s great to see the community helping each other out 😀 |
|
Tony, this is great, thanks. I do have a design issue (the dates are spaced and shown in a grey box), but that is probably a template(UDesign) issue, which I will try to resolve! |
The support post ‘Reformatting [ESPRESSO_VENUE_EVENTS id=1]’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.