Forums › Forums › Search & Filter Pro › S&F with WP_Query
Tagged: Filter Not Working
- This topic has 15 replies, 2 voices, and was last updated 7 years ago by
Anonymous.
-
Anonymous(Private) March 23, 2019 at 9:02 pm #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;
?>Trevor(Private) March 25, 2019 at 11:05 am #206137Hi
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"; } -
AuthorPosts