WordPress.org

Ready to get started?Download WordPress

Forums

Event Organiser
Output event list in columns? (4 posts)

  1. pjoyce
    Member
    Posted 9 months ago #

    I'm currently using the basic code below to display a list of the next 8 upcoming events:

    <div id="featuredPages" class="full homeSection clearfix">
        <h3><span>UPCOMING EVENTS</span></h3>
        <?php echo do_shortcode("[eo_events event_end_after='today' event_start_before='+5 month']<a href='%event_url%'>%event_title%</a><br />on %start{jS M Y}{ g:i:a}%,<br />at %event_venue%[/eo_events]"); ?>
    </div>

    Rather than producing the events in one list, does anyone know a way to output the list into 2 or 3 columns, ie.

    Event 1 Event 4
    Event 2 Event 5
    Event 3 Event 6

    I would prefer it this way to reduce space.

    Sadly I cannot show the current output in a URL as it's for a client.

    Any suggestions are very much appreciated!

    http://wordpress.org/plugins/event-organiser/

  2. Stephen Harris
    Member
    Plugin Author

    Posted 9 months ago #

    If you remove the template tags, it will use this the shortcode event list template (see templates directory). Copy that into your theme and edit it there to display the events in a table.

    See this page for details: http://wp-event-organiser.com/documentation/editing-the-templates/

    (I would recommend not using the shortcode but instead just using the available API: http://codex.wp-event-organiser.com/function-eo_get_events.html - better performance and easier to work with).

  3. pjoyce
    Member
    Posted 9 months ago #

    Stephen,

    Thanks for the reply. I'm not that familar with PHP/API and only created the above code after reading previous replies/snippets of code from other answers.

    However I will have a look at your links and see if something makes sense!

  4. pjoyce
    Member
    Posted 9 months ago #

    Update

    I made a change so the API is used from your link and it now looks like:

    <!-- New section -->
    <div id="featuredPages" class="full homeSection clearfix">
        <h3><span>UPCOMING EVENTS</span></h3>
    <?php
     $events = eo_get_events(array(
             'numberposts'=>10,
             'event_start_after'=>'today',
             'showpastevents'=>true,//Will be deprecated, but set it to true to play it safe.
        ));
    
      if($events):
         echo '<ul>';
         foreach ($events as $event):
              //Check if all day, set format accordingly
              $format = ( eo_is_all_day($event->ID) ? get_option('date_format') : get_option('date_format').' '.get_option('time_format') );
              printf(
                 '<li><a href="%s"> %s </a> on %s </li>',
                 get_permalink($event->ID),
                 get_the_title($event->ID),
                 eo_get_the_start($format, $event->ID,null,$event->occurrence_id)
              );
         endforeach;
         echo '</ul>';
      endif;
     ?>
    </div>
    <!-- New section -->

    It looks good but of course shows the events in one list.

    I'm still not sure how I can get the events listed in a table though. I'm completely new to PHP. I'm guessing I need to look at archive-event.php but am not sure of the next steps.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags