Support

Home Forums Event Espresso Premium Reformatting [ESPRESSO_VENUE_EVENTS id=1]

Reformatting [ESPRESSO_VENUE_EVENTS id=1]

Posted: October 26, 2012 at 3:31 am

Viewing 11 reply threads


bins

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:
Event Name
Event Price
Event Date
Available spaces

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?


Dean

October 26, 2012 at 4:19 am

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.


bins

October 26, 2012 at 4:25 am

Thanks, dean.

Do you have a guide or pointer on how to edit/create new short codes?


Dean

October 26, 2012 at 4:29 am

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.


bins

October 26, 2012 at 4:56 am

Ok, thanks.

Whilst not a php expert, I have been known to fiddle!


Dean

October 26, 2012 at 5:07 am

It’s the best way to learn! Just remember to back things up, especially if you are working on a live server!


Tony Warwick

October 27, 2012 at 6:43 am

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
Any problems with me posting a solution? Thought I’d ask beforehand just to be sure.


Dean

October 29, 2012 at 12:22 am

@Tony, not at all, this is a community so feel free to chime in.


Tony Warwick

October 29, 2012 at 5:59 am

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:

if (isset($id) && $id > 0) {
$atts = array_merge($atts, array('venue_id'=>$id, 'use_venue_id'=>true));
        }

Make a little space under it and add:

    if(isset($show_only_dates) && $show_only_dates == true) {
        $atts['venue_dates_only'] = true;
    }

Save that, open event_list_display.php, at around line 40 you’ll see:

global $this_event_id;
$this_event_id = $event_id;
?>

After the php closing tag (?>), paste something like this:

        &lt;h3 id=&quot;event_date-" class="event_date"&gt;&lt;a title=&quot;" class="a_event_date" id="a_event_date-" href=""&gt;</a>

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:

[ESPRESSO_VENUE_EVENTS id=1 show_only_dates=true]

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.


Tony Warwick

October 29, 2012 at 6:45 am

I cant post php code. Never even thought about that.

Here’s the codes on pastebin:

http://pastebin.com/ccM5yVCL

Or the files already done.

http://depositfiles.com/files/spji5tui4


Dean

October 29, 2012 at 6:52 am

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 😀


bins

October 29, 2012 at 7:05 am

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!

Viewing 11 reply threads

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.

Event Espresso