Support » Plugin: Event Organiser Posterboard » Posterboard Archive Order

  • Resolved Columbus

    (@christof15)


    Hi there, thanks for this beautiful plugin. I would like to ask the following: I’m trying to use the Posterboard on my Events Archive page.
    That works fine but I would like to have the newest Events on top and the older events down.. I know there are some threads and one of them worked almost. I added the following code to my functions.php which works but somehow it shows the future events as well! Is there a fix which could resolve this?

    add_filter('posts_orderby','my_eventorganiser_sort_events',20,2);
    function my_eventorganiser_sort_events( $orderby, $query ){
        global $wpdb;
        if( empty($query->query_vars['orderby']) ){
            if( eventorganiser_is_event_query( $query, true ) ){
                $orderby = " {$wpdb->eo_events}.StartDate DESC, {$wpdb->eo_events}.StartTime DESC";
            }
        }
        return $orderby;
    }

    On the page itself I use:
    [event_board event_start_after=false]

    Thanks in advance!

    https://wordpress.org/plugins/event-organiser-posterboard/

Viewing 1 replies (of 1 total)
  • I found my own solution:

    In you’re Functions.php

    add_filter('posts_orderby','my_eventorganiser_sort_events',20,2);
    function my_eventorganiser_sort_events( $orderby, $query ){
        global $wpdb;
        if( empty($query->query_vars['orderby']) ){
            if( eventorganiser_is_event_query( $query, true ) ){
                $orderby = " {$wpdb->eo_events}.StartDate DESC, {$wpdb->eo_events}.StartTime DESC";
            }
        }
        return $orderby;
    }

    Shortcode in you’re post/page:
    [event_board event_start_after="2010-01-01" event_end_before="yesterday" order="DESC"]

    event_end_before=”now” could work as well..

Viewing 1 replies (of 1 total)
  • The topic ‘Posterboard Archive Order’ is closed to new replies.