Listing venues with descriptions

This topic contains 2 replies, has 2 voices, and was last updated by  Duarte Lourenco 8 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16727

    Hi there,

    Is there a way to have a list of venues with descriptions?
    Listing all the venues with the corresponding link is simple enough:

    [eo_events] %event_venue%[/eo_events]
    

    But I can’t seem to find a way to display the content inserted in the visual/text editor along with the names of the venues

    thank you in advance

    Duarte Lourenco
    #16733

    Hi Duarte

    The above would display the venue of each event returned. So you wouldn’t necessarily get all venues, and you may see duplications.

    There’s no shortcode for listing venues, but you can do the following:

    $venues = eo_get_venues();
    
    if( $venues ){
      foreach($venues as $venue){
         $venue_id = (int) $venue->term_id;
         printf('<a href="%s"><h2>%s</2></a>', eo_get_venue_link($venue_id), esc_html($venue->name));
         echo '<p>' . eo_get_venue_description( $venue_id ) . '</p>';
      }
    }
    

    Documentation on getting venues / venue description can be found here: http://codex.wp-event-organiser.com/function-eo_get_venues.html and here: http://codex.wp-event-organiser.com/function-eo_get_venue_description.html

    If you wanted to turn that into a shortcode, you can find out how here: http://wp-event-organiser.com/blog/tutorial/creating-your-own-shortcodes/.

    The code for defining a shortcode should go in a utility plug-in or theme’s functions.php, or you could put the above snippet in a template.

    Stephen Harris
    #16744

    That is great and it works ofc, thank you!

    Duarte Lourenco
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.