• Resolved e.ghignone

    (@eghignone)


    Hi,
    I make a custom query to search event from category and tag..but I have problems with recurring events.
    In fact, I want to be shown in the search result only the next event and not all occurrences of that event. I managed to do this by removing the duplicates in the loop, but the pagination is wrong because It also calculates recurring events. How can i group by eo_event.post_id instead eo_event.event_id in the main query?

    this is my query

    $connected = new WP_Query( array(
      'post_type' => 'event',
      'cat' => $cat,
      'orderby' => $orderby,
      'order' => $order,
      'paged'  => $paged,
      'posts_per_page' => $posts_per_page,
    
    ) );

    and this is my pagination code

    ${'page_args_'.$currenttab} = array(
    'base'      => @add_query_arg( 'page_'.$currenttab, '%#%' ),
    'current' => ${'page_'.$currenttab},
     'total'   => $$currenttab->max_num_pages,
    'add_fragment'  =>'#tab_'.$currenttab
    );
    
     echo paginate_links( ${'page_args_'.$currenttab} );

    The page is divide in tab, each one search by different post_type..

    thanks for an answer

    https://www.ads-software.com/plugins/event-organiser/

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

    (@stephenharris)

    You want to set group_events_by to series. This page has more details: https://codex.wp-event-organiser.com/function-eo_get_events.html.

    Plugin Author Stephen Harris

    (@stephenharris)

    Actually, that page doesn’t. But

    $connected = new WP_Query( array(
      'post_type' => 'event',
      'group_events_by' => 'series',
      'cat' => $cat,
      'orderby' => $orderby,
      'order' => $order,
      'paged'  => $paged,
      'posts_per_page' => $posts_per_page,
    
    ) );

    is what you’re after nonetheless. However, keep in mind in that ‘cat’ does not refer to the event categories. The taxonomy for event categories is event-category.

    Thread Starter e.ghignone

    (@eghignone)

    Thank you, now it’s works.
    I delete the taxonomy Event-category to use the same category for all my post_type.

    Thank a lot

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘group by id for correcting pagination’ is closed to new replies.