Support

Home Forums Event Espresso Premium Single Event Template Question

Single Event Template Question

Posted: August 12, 2014 at 5:51 am


Stephen Pearson

August 12, 2014 at 5:51 am

Here is my single archive file. Notice at the bottom I have the venue tag. It is not pulling in the values. Can you help.

<?php get_header(); ?>
<?php cherry_setPostViews(get_the_ID()); ?>
<div class=”motopress-wrapper content-holder clearfix”>
<div class=”container”>
<div class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-wrapper-file=”page-fullwidth.php” data-motopress-wrapper-type=”content”>
<div class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-type=”static” data-motopress-static-file=”static/static-title.php”>
<?php get_template_part(“static/static-title”); ?>
</div>
</div>
<div id=”content” class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-type=”loop” data-motopress-loop-file=”loop/loop-page.php”>
<?php get_template_part(“loop/loop-page”); ?> <?php espresso_event_venues(); ?>

</div>
</div>
</div>
</div>
</div>
</div>


Josh

  • Support Staff

August 12, 2014 at 10:26 am

Hi Stephen,

It turns out that espresso_event_venues() requires the Venue View helper. So you can add the following to your event template to load it:

<?php EE_Registry::instance()->load_helper('Venue_View'); ?>

There is more info here:

https://eventespresso.com/wiki/ee4-themes-templates/#venue-view


Stephen Pearson

August 12, 2014 at 11:07 am

Josh I have included the instance. still nothing:

<?php get_header(); ?>
<?php EE_Registry::instance()->load_helper(‘Venue_View’); ?>
<?php cherry_setPostViews(get_the_ID()); ?>
<div class=”motopress-wrapper content-holder clearfix”>
<div class=”container”>
<div class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-wrapper-file=”page-fullwidth.php” data-motopress-wrapper-type=”content”>
<div class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-type=”static” data-motopress-static-file=”static/static-title.php”>
<?php get_template_part(“static/static-title”); ?>
</div>
</div>
<div id=”content” class=”row”>
<div class=”<?php echo cherry_get_layout_class( ‘full_width_content’ ); ?>” data-motopress-type=”loop” data-motopress-loop-file=”loop/loop-page.php”>
<?php get_template_part(“loop/loop-page”); ?> <?php espresso_event_venues(); ?>

</div>
</div>
</div>
</div>
</div>
</div>


Josh

  • Support Staff

August 12, 2014 at 11:13 am

Are you loading the events via the loop template or from another template part?


Stephen Pearson

August 12, 2014 at 2:23 pm

I have it under the loop section do you recommend putting it somewhere else.


Stephen Pearson

August 12, 2014 at 2:25 pm

Do you have an example of that section so I can see what I am doing wrong. Thanks


Josh

  • Support Staff

August 12, 2014 at 2:25 pm

What I mean is, it looks like you’re trying to load up the venue information outside of the loop. So in this case it may help to move your template tag into the loop.


Stephen Pearson

August 12, 2014 at 3:28 pm

Josh,
I am new to this. Could you give me an example of loading it correctly in the loop. I have reviewed the WP codex and have tried the way they say to do this but it still is no working. If you could show me this one I will be able to figure any future ones out. Thanks.


Josh

  • Support Staff

August 13, 2014 at 2:22 pm

Hi Stephen,

Can you let me know exactly what Venue information you are trying to display so I can work up an example?

As an aside, can you share the link to the WP codex article that you are using? It might help to know that an event post isn’t the same thing as a regular WP post, and using one of Event Espresso’s template tag that’s dependent on a helper method isn’t something you’d likely find in the WP codex.


Stephen Pearson

August 13, 2014 at 6:35 pm

I would like to show all details. I then can learn how to do other parameters. The codex I am using is http://codex.wordpress.org/Templates and http://codex.wordpress.org/The_Loop


Josh

  • Support Staff

August 14, 2014 at 2:26 pm

Hi Stephen,

I’d also recommend the Post Type Templates article in the codex:

http://codex.wordpress.org/Post_Type_Templates

Note that your single event template needs to be named single-espresso_events.php

Along with that, you might find it to be easier to use the other Venue template tags, like espresso_venue_name() and espresso_venue_address() but here’s an example of how to use the espresso_event_venues() tag to get the event name, address, city, and state:

//Get the venue for this event
$venues = espresso_event_venues();
$venue = array_shift( $venues );

if ( $venue instanceof EE_Venue ) {
	$venue_name = $venue->name();
	$venue_address = $venue->address();
	$venue_city = $venue->city();
	if ($venue->state_obj() instanceof EE_State ) {
		$state = $venue->state_obj()->name();
	}
} else {
	$venue_name = '';
	$venue_address = '';
	$venue_city = '';
	$state = '';
}

// then echo the above variables into your html


Stephen Pearson

August 14, 2014 at 3:27 pm

THanks I will give it a shot. Do you know if there are any shortcodes for the venues in ee4?


Josh

  • Support Staff

August 14, 2014 at 8:41 pm

Hi Stephen,

As of today (August 14, 2014) Event Espresso 4 does not have shortcodes for venues. There are a number of template tags that can be used within a template though. They are listed in this document:

https://eventespresso.com/wiki/ee4-themes-templates/#venue-view


Stephen Pearson

August 18, 2014 at 1:59 pm

Josh,
I am frustrated trying to get this template to work. Can you recommend an inexpensive template developer to develop a single template page for me


Josh

  • Support Staff

August 18, 2014 at 7:22 pm

Hi Stephen,

I can recommend looking at the built in templates that Event Espresso 4 includes. You’ll want to review single-espresso_events.php and content-espresso_events.php along with the template parts that are called. All of the included template files can be found in the /templates/Espresso_Arabica_2014 folder.

If you require the services of a developer, we have a page that lists out recommended developers:

https://eventespresso.com/developers/event-espresso-pros/


Stephen Pearson

August 19, 2014 at 3:50 pm

Still working on this I need to learn. So I used the sample template and have made the adjustments to make it work in my theme. My question is how do I put the event description up top and the ticket option at the bottom in the template and how do I get rid of the second set of class information being shown. One looks short the other longer.

// Start the Loop.
while ( have_posts() ) : the_post();
// Include the post TYPE-specific template for the content.
espresso_get_template_part( ‘content’, ‘espresso_events’ );


Josh

  • Support Staff

August 19, 2014 at 4:19 pm

Hi Stephen,

In the last line of code that you posted above, it’s giving an instruction to load up the content-espresso_events.php template part. You’ll find that if you open up content-espresso_events.php in a text editor, remove or move around the calls to the different template parts, then save, it will change what you see on the event page.

You’ll also see that the first part handles the Single event view ( everything after if (is_single() ) : ) and the second part handles the archive view ( after elseif (is_archive() ) : )

This allows for different layouts and content in each of the two views.


Stephen Pearson

August 19, 2014 at 7:54 pm

Ok I got it working almost the way IO want it just a few more tweaks. Thanks Josh. The only thing that is strange is the venue display is not working and when I look at the called file it references EE3.


Josh

  • Support Staff

August 20, 2014 at 9:41 am

Hi Stephen,

Did you include the venue view helper? Can you let me know what file references Event Espresso 3?


Stephen Pearson

August 20, 2014 at 11:02 am

I was wrong it listed it as H3 not EE3. I am trying to edit the single venue view. I have made changes in the content-espresso_venues.php but nothing happens the same page I started with without changes appears. Is this the wrong file to edit to make changes to the single venue view?


Stephen Pearson

August 20, 2014 at 11:14 am

Josh figured it out and moved the single venue file over. Things are coming together lol.

The support post ‘Single Event Template Question’ 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