• Hi Stephen,

    First of all, thank you so much for all your hard work on this plugin. It’s head and shoulders above the rest in this category.

    For the template taxonomy-event-tag, my tag pulls both recurring and non-recurring events. From what I can tell, the events are sorted by start date. What I’d like is, in the case of recurring events, that the current occurrence date or next occurrence date be used for sorting rather than the start date. Is this possible?

    I’ve been looking through your codex and forums, but I’m relatively new to WordPress and not sure how to modify the Loop’s output.

    Thanks in advance,
    Suzanne

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi Suzanne,

    Thanks! (I’d always appreciate a good review 😉 ).

    You can do this, but only if you ‘group occurrences’. When events are grouped, only one date appears for each distinct event, regardless of whether it is recurring or not. There’s a setting for that, but if you only want it to apply to the event tag pages then you can do it via code:

    add_action( 'pre_get_posts', 'shahn1234_group_occurrences' );
    function shahn1234_group_occurrences( $query ){
         if( eventorganiser_is_event_query( $query )
             && $query->is_main_query()
             && is_tax( 'event-tag' ) ){
    
             $query->set( 'group_events_by', 'series' );
             $query->set( 'event_start_after', 'now' );
    
         }
    }
    Thread Starter shahn1234

    (@shahn1234)

    Wonderful! Works like a charm!

    Thank you – I just gave you a stellar review. 😉

    Plugin Author Stephen Harris

    (@stephenharris)

    As per this post it is recommended that before you use any event organiser function inside a theme or another plug-in that you check first that Event Organiser is active. Apart from manual deactivation, Event Organiser’s files are not loaded during an update. Although rare, this can cause a fatal error when using its functions in a theme/plug-in.

    The following is a safer version of the above:

    add_action( 'pre_get_posts', 'shahn1234_group_occurrences' );
    function shahn1234_group_occurrences( $query ){
         if( defined( 'EVENT_ORGANISER_VER' ) && eventorganiser_is_event_query( $query )
             && $query->is_main_query()
             && is_tax( 'event-tag' ) ){
    
             $query->set( 'group_events_by', 'series' );
             $query->set( 'event_start_after', 'now' );
    
         }
    }

    (another constant that can be used is EVENT_ORGANISER_DIR – alternatively you can also use function_exists() to check a function exists before using it)/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort order for taxonomy-event-tag.php’ is closed to new replies.