Forums Forums Search & Filter Pro S&F with WP_Query

  • This topic has 15 replies, 2 voices, and was last updated 7 years ago by Anonymous.
Viewing 10 posts - 1 through 10 (of 16 total)
  • Anonymous
    #206109

    Hello, i bought S&F today and i want to use this with a wp_query.
    If i remove the second line of my query, my loop works but with this line, only one iteration is return. I don’t know why. I follow https://searchandfilter.com/documentation/search-results/custom/
    I don’t know what is wrong.
    Sorry for my english i’m french :/!

    <?php
    $args = array (
    ‘post_type’ => ‘mandat_de_vente’,
    ‘search_filter_id’ => 482,
    ‘posts_per_page’ => – 1,
    ‘orderby’ => DESC,
    );
    // $args [‘search_filter_id’] = 482;
    $query = new WP_Query( $args ); ?>
    <?php while ( $query -> have_posts() ) : $query -> the_post(); ?>
    <?php wp_reset_postdata(), endwhile;
    ?>

    Anonymous
    #206122

    Someone can help please ?

    Trevor
    #206137

    Hi

    I am sorry but we are closed over weekends and public holidays. After the line:

    $query = new WP_Query( $args );

    My basic code would be this (no wp_reset_postdada):

    if ( $query->have_posts() ) {
      while ($query->have_posts()) {
        $query->the_post();
    // output the post here
      }
    } else {
      echo "No Results Found";
    }
    Anonymous
    #206202

    Hi,

    It doesn’t work. When loading my page I always have only one item loaded. On the other hand if I remove
    “$ args[‘search_filter_id’] = 482;”
    I have all my elements that are loaded but suddenly the search, it does not work anymore

    Trevor
    #206273
    This reply has been marked as private.
    Anonymous
    #206290
    This reply has been marked as private.
    Trevor
    #206304
    This reply has been marked as private.
    Anonymous
    #206308
    This reply has been marked as private.
    Trevor
    #206316
    This reply has been marked as private.
    Anonymous
    #206322
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 16 total)