Support

Home Forums Event Espresso Premium Get event details in template

Get event details in template

Posted: August 13, 2014 at 2:58 am

Viewing 2 reply threads


Jackie Blaker

August 13, 2014 at 2:58 am

Hi Guys,

Josh sent me a very helpful snippet yesterday which is great but i need to expand on it.

I need to be able to get the event date, location and a link to buy the tickets so i can display a list of 3 upcoming events.

This is the snippet from github, + i added a date output before remembering that this is the post date not the event date.

I need to output the information in the ‘Upcomming events’ box on the right, which you can see here: http://preview1.maxx-design.co.uk/acs/15.htm

<ul class="events">
                    <?php
                    $atts = array(
                        'title' => NULL,
                        'limit' => 3,
                        'css_class' => NULL,
                        'show_expired' => FALSE,
                        'month' => NULL,
                        'category_slug' => NULL,
                        'order_by' => 'start_date',
                        'sort' => 'ASC'
                    );
                    // run the query
                    global $wp_query;
                    $wp_query = new EE_Event_List_Query( $atts );
                    if (have_posts()) : while (have_posts()) : the_post();
                        ?>
                        <li><?php the_date('d.m.Y'); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                    <?php
                    endwhile;
                    else:
                        ?>
                        <li>No Upcoming Events</li>
                    <?php
                    endif;
                    // now reset the query and postdata
                    wp_reset_query();
                    wp_reset_postdata();
                    ?>
                </ul>

Is there any specific documentation for the functions i’d need to use?

Its worth noting that im primerally a Drupal developer so i don’t have much experiance with wordpress at all.

Thanks


Josh

  • Support Staff

August 13, 2014 at 9:16 am

Hi Jackie,

There are a number of template tags that you can use to display this information. The template tags require a view helper.

You can load the Event View helper by adding this to your template (for the date and register button) :

EE_Registry::instance()->load_helper('Event_View');

You can load the Venue View helper by adding this to your template (for the location) :

EE_Registry::instance()->load_helper('Venue_View');

Here is a link to the documentation for the template tags you’ll be able to use in your template with the loaded view helpers:

https://eventespresso.com/wiki/ee4-themes-templates/


Jackie Blaker

August 14, 2014 at 4:21 am

Hi Josh,

Thanks for that! it was exactly what i needed 🙂

Viewing 2 reply threads

The support post ‘Get event details in template’ 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