Support

Home Forums Event Espresso Premium Display event venue details as a sidebar

Display event venue details as a sidebar

Posted: July 9, 2015 at 1:09 pm

Viewing 5 reply threads


Deborah Fox

July 9, 2015 at 1:09 pm

On single event pages, I’d like to move the venue information to a sidebar, like shown on this page:
https://ethicsinsociety.stanford.edu/events/lectures/special-events/peter-singer-the-most-good-you-can-do
What would be the best way to do this?


WisdmLabs

July 10, 2015 at 3:50 am

You can create a shortcode for displaying event venue in sidebar as follow:

add_shortcode('event_tags','fun_display_event_tags');
function fun_display_event_tags()
{
	
	$id = get_the_ID();
	if ( is_single() && get_post_type($id) == 'espresso_events' ) :
		 $VNU_ID = espresso_venue_id( $id ); //Get venue id
		 $venue_description = espresso_venue_description( $VNU_ID, FALSE ); //Venue description
		 $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE );
//Venue short description
		 $address = espresso_venue_address('multiline', $VNU_ID, TRUE  ); //Venue address details (City, state, country etc)
	endif;
}


Dean

July 10, 2015 at 4:33 am

That’s a nice little shortcode WisdmLabs!

Can I add one thing to it?

As that shortcode will likely be used in a Text Widget, add the following code before the above code:

add_filter('widget_text', 'do_shortcode');

Not all themes allow shortcodes to be added to Text Widgets. That code will enable it.

Also, that code would need to be added to a site specific plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ (or your themes functions.php should work, but I highly recommend using a site specific plugin).


Deborah Fox

July 10, 2015 at 8:22 am

Wow, thank you WisdmLabs and Dean! I must confess, this is getting beyond my capabilities. I do have a site specific plugin I’ve been using, but adding this code into it hasn’t changed my page. Is there something else I should be adding to my single-epresso_events template to pick up on this addition?


Lorenzo Orlando Caum

  • Support Staff

July 10, 2015 at 9:01 am

Hi Deborah,

This actually creates a new shortcode that you can use to display that information in a widget. First, you would add that sample code to your theme’s functions.php file or a site specific plugin.

Then you would add the shortcode for [event_tags] to something like a text widget through Appearance –> Widgets.


Lorenzo


Deborah Fox

July 16, 2015 at 1:18 pm

I came up with a different solution. On the content-espresso_events.php file, I deleted this line: <?php get_template_part( ‘content-espresso_events-venues’); ?>. Then on the single-espresso_events.php file I’ve saved within my child theme, I added that line to the div class for the right side of the page. Worked great.

Viewing 5 reply threads

The support post ‘Display event venue details as a sidebar’ 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