• I’m attempting to set up an agenda view using the default archive for events at mysite.com/events (this is a Genesis child theme).

    It mostly works great! The events pull in, and the category links also pull in events on the appropriate category. I had two issues: 1) the events were not using the correct order, and 2) past events show up in this view.

    The first issue I resolved by modifying the query:
    https://gist.github.com/jonschr/c26852dbe62fa3ec251a9a4466e53836

    The second issue should be resolvable by modifying the query in a similar way. I see what I need; it’s the ‘start’ column – I want to do a meta query which compares ‘start’ to time(), essentially.

    Something like this added to the pre_get_posts hook:

    
    $meta_query = array(
         array(
              'key' => 'start',
              'value' => time(),
              'compare' => '>'
         )
    );
    $query->set( 'meta_query', $meta_query );
    

    However, I seem unable to do this sort of meta query because the information is in a nonstandard table (it’s not in the post_meta table, but rather in the sc_events table).

    I wondered if you might be able to point me in the right direction.

Viewing 1 replies (of 1 total)
  • Thread Starter Jon Schroeder

    (@jonschr)

    Welp. After fiddling with this for a couple of hours right before posting this, I just found it.

    
    $query->set( '_sc_display', 'upcoming' );
    

    I do wonder why the _sc_display and _sc_order components of the query aren’t functioning correctly on Genesis. If these were set to have different defaults (‘upcoming’ and ‘ASC’), it might make this plugin slightly easier to use for Genesis users.

    Don’t think I need anything at the moment; this gets me all set, but still might be useful feedback for you guys.

Viewing 1 replies (of 1 total)
  • The topic ‘Genesis theme showing past events on default archives’ is closed to new replies.