Support » Plugin: Event Organiser » Show more than 8 events in CATEGORY Event listing page

  • I figured out how to show more events on the overall event listings page by editing the functions.php but what I cant figure out is how to make more than 8 events to show up on a Category’s event listings page. It shows 8 then pagination happens. (older events/newer events)

    /events/event/
    shows 200 (I set that in functions.php)

    /events/category/special-events/
    shows 8 (not sure where to edit it to display more)

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

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

    (@stephenharris)

    I’m assuming for the events page you’re using pre_get_posts. The same principle will apply (check $query->is_main_query() and eventorganiser_is_event_query( $query ) if return true) except that the page you’ll want to check is is_tax('event-category') ( see http://codex.wordpress.org/Function_Reference/is_tax ). You can specify ‘special-events’ as the term if you want to change the events per page specifically for special events.

    the changes im making to functions.php is causing the site to break… so im guessing i just add this but with a slight change as you mantion above… can you edit this and let me know exactly what to copy/paste at the bottom of my functions.php?

    add_action( 'pre_get_posts', 'cindy_show_all_events' );
     function cindy_show_all_events( $query ){
          if( $query->is_main_query() && 'event' == $query->get( 'post_type' ) ){
                   $query->set( 'posts_per_page', 150 );
         }
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Plugin Author Stephen Harris

    (@stephenharris)

    Untested, but something like:

    add_action( 'pre_get_posts', 'cindy_show_all_events' );
    function cindy_show_all_events( $query ){
        if(  $query->is_main_query() &&  eventorganiser_is_event_query( $query ) ){
    
           if( is_tax( 'event-category' ) ){
               //Event category page
               $query->set( 'posts_per_page', 100 );
           }else{
                //Any other event page
               $query->set( 'posts_per_page', 150 );
           }
    
        }
    }

    worked! thanks a million!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show more than 8 events in CATEGORY Event listing page’ is closed to new replies.