Support

Home Forums Event Espresso Premium EE4: List Events By Vunue

EE4: List Events By Vunue

Posted: June 18, 2015 at 12:44 am

Viewing 6 reply threads


David Holland

June 18, 2015 at 12:44 am

Is there somebody have the best solution to make this happen in EE4?


Lorenzo Orlando Caum

  • Support Staff

June 18, 2015 at 10:39 am

Hi, that isn’t supported at this time. However, a workaround is to use event categories.

Here is another option:

https://eventespresso.com/wiki/useful-php-code-snippets/#venue-event-list


Lorenzo


David Holland

June 22, 2015 at 12:18 am

My developer posted this question and deployed the code above but the shortcode didn’t work.


Dean

June 22, 2015 at 2:49 am

Hi,

The code Lorenzo linked to isn’t a shortcode. What it does is add a list of events to the Venues page.

E.g. if you have a venue called ThePlace, and you visited yoursite.com/venues/theplace, it would show the venue information and with this function it would list the events below the venue description.

You could convert the function to a shortcode fairly easily, here is an example (please only use as a basis for your own code, it has NOT been tested, it is just an example):

function venue_events_shortcode( $atts ) {
    // query the events for this venue using EE_Venue's events() method
    // http://code.eventespresso.com/classes/EE_Venue.html#method_events
    $query_params = array( 
        array( 
            'status' => 'publish', 
            'Datetime.DTT_EVT_start' => array( 
                '>', 
                date( current_time( 'mysql' ) ), 
                'Datetime.DTT_EVT_end' => array(
                    '<', 
                    date( current_time( 'mysql' ) )
                ) 
            )
        )
    );
//Will need to call the helper class. This isn't an ideal way to do it, but it works for this example.
    require_once ABSPATH . '/wp-content/plugins/event-espresso-core-reg/core/helpers/EEH_Venue_View.helper.php';

    $venue_id = $atts['venue_id'];

    $venue_post = get_post( $venue_id, OBJECT );

    $events = EEH_Venue_View::get_venue( $venue_post->ID )->events( $query_params );

    // start the output
    echo '<h3>Upcoming events at this venue</h3><ul>';
    // the loop
    foreach ( $events as $event ) {
        echo '<li>';
        echo '<a href="' . get_permalink( $event->get( 'EVT_ID' ) ) . '">' . $event->get( 'EVT_name' ) . '</a>';
        echo '</li>';
    }
    echo '</ul>';    
    // end the output
}
add_shortcode( 'venueevent', 'venue_events_shortcode' );

//Usage would be [venueevent venue_id=23]


David Holland

June 23, 2015 at 11:52 pm

Thanks Dean, This code works and display event by venue., However, we also need to display tickets available on each event and book from there, Like when we view a single event that list the tickets available.
Thank you so much!


David Holland

June 23, 2015 at 11:57 pm

Hi Dean, can you help us to come up with the solution required from the above comment? Thanks!


Dean

June 24, 2015 at 4:46 am

Hi David,

Support can’t provide customisation solutions unfortunately. The above code should enable a developer to take it forward and create what you need, and we have a list of recommended developers that work with Event Espresso here: https://eventespresso.com/developers/event-espresso-pros/

Viewing 6 reply threads

The support post ‘EE4: List Events By Vunue’ 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