• Resolved gregoire1974

    (@gregoire1974)


    Hi,

    I thouroughly enjoy the plugin, yet I’m wondering if there’s a way to display a simple list of events (if it could be only past events that would be great but all events is fine as well)
    Maybe I missed some capacities of displaying using “agenda” but to me the closest is “row”, yet I would enjoy being able to specify which fields to display (say “Date, venue”) so that it gives a very basic list of the events. I would like to discard the picture and many other information to cut it down to a minimal list for one given type of event.

    Is there a way to do this using shortcodes, or any other way ?

    Thanks in advance for your answer.

    Gregoire Levasseur

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support epsupport1

    (@epsupport1)

    Thank you for your positive feedback on the plugin — we’re glad to hear you’re enjoying it!

    Regarding your request for a simple, minimal list view of events (such as showing only the date and venue, without images or additional details), you can achieve something similar by using our Event List Widgets extension:

    Event List Widgets Extension:
    This allows you to display selected events in a list format. You can also choose which events to highlight by marking them as Featured Events.
    Link: Event List Widgets Extension (theeventprime.com/all-extensions/event-list-widgets)

    At the moment, displaying a shortcode-based event list without the event image or additional fields is not natively supported. We will add this feature in our upcoming releases.

    If you have any further questions, please don’t hesitate to reach out to us.

    • This reply was modified 3 weeks, 6 days ago by epsupport1.
    Thread Starter gregoire1974

    (@gregoire1974)

    Thanks for your answer,

    Unfortunately I can’t afford the widget the website I’m webmastering, because it’s for a non-profit (and poor) amateur theatre company playing for free. I have to set everything up on freemium :/
    I’m glad many plugins, including yours, are.

    I’ll wait until the feature is available 😉

    In the mean time, do you know if is there any way round I should consider, like using some simple export to a text file and parse the data (even if it does not actualize in real time), I should be glad with ?

    Thanks a lot again, appreciate your support

    Have you tried their free import/export plugin. I haven’t used it, but it sounds like it might be a starting point for what you want to do.

    Thread Starter gregoire1974

    (@gregoire1974)

    Hi Larry,
    I manage to create my own shortcode using code snippets plugin. Didn’t use the import/export because I wanted the list to be dynamicaly updated. Made a custom shortcode to retrive information from the plugin pages. Had to ask some IA to make little script to test retrieving. Ended up with exactely what I wanted : Short list with : Event title / Date / venue and a link on the title redirecting to the plugin event page (../all-events/?event=”ID”). Very convenient, works smoothly.
    Can provide the code if need be.

    Thread Starter gregoire1974

    (@gregoire1974)

    Hi all, Here come the code 😉 I’ve added it to code snippets as a php code. I post it there with a max of comment on how it goes 😉
    Feel free to use it 😉

    You might have to do a bit of CSS styling but it basically does the job
    Greg

    /**

     * Shortcode: [ep_simple_list]

     * Displays a simplified list of EventPrime events, grouped into upcoming and past events.

     *

     * Shortcode attributes:

     * - type=""      → event type slug (EventPrime taxonomy)

     * - limit=-1     → maximum number of events to display (-1 = no limit)

     * - order="DESC" → sorting order based on event start date

     * - date="true"  → display event date

     * - venue="true" → display event venue

     * - upcoming=-1  → -1 = all events, 0 = past only, 1 = upcoming only

     */

    function simple_eventprime_list( $atts ) {

        /**

         * Define shortcode attributes and defaults.

         */

        $atts = shortcode_atts( array(

            'type'     => '',

            'limit'    => -1,

            'order'    => 'DESC',

            'date'     => 'true',

            'venue'    => 'true',

            'upcoming' => -1, // Default: show both upcoming and past events

        ), $atts );

        /**

         * Query all EventPrime events.

         * We fetch all events and handle date filtering manually.

         */

        $args = array(

            'post_type'      => 'em_event',

            'posts_per_page' => -1,

            'meta_key'       => 'em_start_date_time',

            'orderby'        => 'meta_value_num',

            'order'          => $atts['order'],

        );

        /**

         * If an event type is provided, filter by taxonomy.

         */

        if ( ! empty( $atts['type'] ) ) {

            $args['tax_query'] = array(

                array(

                    'taxonomy' => 'em_event_type',

                    'field'    => 'slug',

                    'terms'    => $atts['type'],

                ),

            );

        }

        $query = new WP_Query( $args );

        /**

         * Prepare arrays for upcoming and past events.

         */

        $now = current_time('timestamp');

        $upcoming_events = [];

        $past_events     = [];

        /**

         * Retrieve the page used to display single EventPrime events.

         * Example: /all-events/?event=123

         */

        $listing_page = get_page_by_path('all-events');

        /**

         * Loop through events and separate them based on date.

         */

        if ( $query->have_posts() ) {

            while ( $query->have_posts() ) {

                $query->the_post();

                $event_id  = get_the_ID();

                $timestamp = get_post_meta( $event_id, 'em_start_date_time', true );

                if ( ! $timestamp ) continue;

                // Classify event as upcoming or past

                if ( $timestamp >= $now ) {

                    $upcoming_events[] = $event_id;

                } else {

                    $past_events[] = $event_id;

                }

            }

        }

        wp_reset_postdata();

        /**

         * Start output buffering to return clean HTML.

         */

        ob_start();

        /**

         * Helper function to output an event list section.

         */

        $display_events = function( $event_ids, $title ) use ( $atts, $listing_page ) {

            if ( empty( $event_ids ) ) return;

            // Section title (e.g., "Upcoming Performances")

            echo '<h5 style="font-weight:bold;">' . esc_html($title) . '</h5>';

            echo '<ul class="simple-eventprime-list">';

            $count = 0;

            foreach ( $event_ids as $event_id ) {

                // Apply "limit" attribute

                if ( $atts['limit'] > 0 && $count >= $atts['limit'] ) break;

                $count++;

                $event_title = get_the_title( $event_id );

                /**

                 * Build event link

                 * Preference: EventPrime listing page with ?event=ID

                 * Fallback: event permalink

                 */

                if ( $listing_page ) {

                    $event_link = add_query_arg('event', $event_id, get_permalink($listing_page->ID));

                } else {

                    $event_link = get_permalink($event_id);

                }

                echo '<li>';

                echo '<strong><a class="simple-eventprime-link" href="' . esc_url($event_link) . '">' . esc_html($event_title) . '</a></strong>';

                /**

                 * Display date if enabled.

                 */

                if ( $atts['date'] === 'true' ) {

                    $timestamp = get_post_meta( $event_id, 'em_start_date_time', true );

                    if ( $timestamp ) {

                        echo ' – <em>' . date('d/m/Y', $timestamp) . '</em>';

                    }

                }

                /**

                 * Display venue if enabled.

                 * Uses EventPrime taxonomy: em_venue

                 */

                if ( $atts['venue'] === 'true' ) {

                    $venue_terms = get_the_terms( $event_id, 'em_venue' );

                    if ( $venue_terms && ! is_wp_error( $venue_terms ) ) {

                        $venue_name = implode( ', ', wp_list_pluck( $venue_terms, 'name' ) );

                        echo ' – <em>[' . esc_html( $venue_name ) . ']</em>';

                    }

                }

                echo '</li>';

            }

            echo '</ul>';

        };

        /**

         * Display lists depending on "upcoming" attribute.

         */

        if ( $atts['upcoming'] == -1 ) {

            // Display both upcoming and past events

            $display_events( $upcoming_events, 'Upcoming Performances' );

            $display_events( $past_events, 'Past Performances' );

        } elseif ( $atts['upcoming'] == 1 ) {

            // Upcoming only

            $display_events( $upcoming_events, 'Upcoming Performances' );

        } elseif ( $atts['upcoming'] == 0 ) {

            // Past only

            $display_events( $past_events, 'Past Performances' );

        }

        /**

         * Fallback message if no events are found.

         */

        if ( empty($upcoming_events) && empty($past_events) ) {

            echo '<p class="simple-eventprime-none">No events found.</p>';

        }

        return ob_get_clean();

    }

    add_shortcode( 'ep_simple_list', 'simple_eventprime_list' );
    Thread Starter gregoire1974

    (@gregoire1974)

    Documentation — Shortcode [ep_simple_list]
    Overview
    [ep_simple_list] is a custom WordPress shortcode designed to display events from the EventPrime
    plugin in a simplified list format. It allows you to show upcoming, past, or all events, optionally including
    event date and venue.
    Shortcode
    [ep_simple_list]
    Available Attributes
    type: Filters events by EventPrime event type.
    limit: Maximum number of events per section (-1 = unlimited).
    order: Sort order ASC or DESC.
    date: Show or hide dates.
    venue: Show or hide venues.
    upcoming: -1 = all, 0 = past only, 1 = upcoming only.
    Examples
    [ep_simple_list]
    [ep_simple_list upcoming="1"]
    [ep_simple_list upcoming="0"]
    [ep_simple_list upcoming="1" limit="5"]
    [ep_simple_list type="theatre"]
    [ep_simple_list venue="false"]
    [ep_simple_list date="false"]


    [ep_simple_list type="comedy" upcoming="-1" limit="10"]

    Thread Starter gregoire1974

    (@gregoire1974)

    Hi Larry and Steff,
    Would you just confirm you were able to see & retrieve the code I pasted, otherwise I can provide it differently.
    😉

    Moderator Support Moderator

    (@moderator)

    Please do not take over someone else’s topic. If you need support then per the forum guidelines please start your own topic.

    https://wordpress.org/support/forum-user-guide/faq/#i-have-the-same-problem-can-i-just-reply-to-someone-elses-post-with-me-too

    If you need support you can start your own topic here.

    https://wordpress.org/support/plugin/eventprime-event-calendar-management/

    The many “I have this problem too” replies have been removed.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Create a simple list of events’ is closed to new replies.