Short code for Venues

There aren’t currently any shortcodes for venue information (address, postcode, other meta etc). However, you can copy the single-event.php template (find it in the templates directory of the plug-in) into your theme and edit it there to include venue information via provided template functions:

Available functions

When used inside the loop, you don’t need to provide any parameters – it uses the veneu of the current event.

  • eo_get_venue_address() – returns an array of the form

    array(
        'address' => ,//Address of the venue as entered on the admin page
        'postcode' => ,//Venue postcode
        'country' => ,//Venue country
    )
    
  • eo_get_venue() – returns the venue ID of the current event

  • eo_get_venue_description() – returns the description of the venue (eo_venue_description() prints it)

  • eo_get_venue_name() – returns the name of the venue

  • eo_get_venue_meta(eo_get_venue(),'key') – Get meta for this venue with key ‘key’.

This is an incomplete list (see source for more). Outside the loop you will need to provide a venue ID (int) or slug (string). Documentation can be found here.

Example

For instance, you could have the following to immediately after <?php the_content();?> in the template file, to print some venue details:

<div class="venue-details" >
     <?php printf('<h2> %s </h2>', eo_get_venue_name() ); ?>

     <?php
       $address = array_filter(eo_get_venue_address());
       if ($address)
         printf('<p> %s </p>', implode(', ', $address)); 
      ?>

      <?php printf('<div class="venue-description"> %s </div>', eo_get_venue_description() ); ?>

</div>

You will probably need to add some styling to make it look nice, or just use the appropriate classes for your theme.

Note

I plan on adding some more shortcodes, but if you, or anyone does so before me, feel free to contact me via the plug-in’s forums – you’ll get plenty of credit :).

I’ve not tested the above – so there may be syntax errors. If you have any problems implementing it, it might be best to contact me via the forums.