Forums Forums Search & Filter Pro Beaver Themer integration info on documentaion page #2

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #134668

    This is additional info to integrate S&F to BeaverBuilder/BeaverThemer
    Pagination problem in ajax mode needs this to reset the page number.
    if(isset($_GET['sf_paged'])){ global $wp_the_query; $wp_the_query->set('paged',$_GET['sf_paged']); }

    Also when you want to filter Posts module on a Page but Themer’s archive layout, pre_get_posts action works.
    To target specific page/module, I used is_page(), query_vars[‘fl_builder_loop’] and query_vars[‘post_type’].
    Then use $query->set(“search_filter_id”,***);

    So the function will be like this.

    function my_pre_get_posts_function($query){
      if(is_page(999) && $query->query_vars['fl_builder_loop'] == 1 && $query->query_vars['post_type'] == 'some_cpt'){
        $query->set("search_filter_id",111);
    }
    if(isset($_GET['sf_paged'])){ global $wp_the_query; $wp_the_query->set('paged',$_GET['sf_paged']); }
    }
    add_action('pre_get_posts','my_pre_get_posts_function');
    
    Trevor
    #134808

    Thanks for this!!

Viewing 2 posts - 1 through 2 (of 2 total)