Forums › Forums › Search & Filter Pro › change the posts_per_page argument in WP Query
- This topic has 8 replies, 2 voices, and was last updated 7 years, 3 months ago by Anonymous.
-
Anonymous(Private) July 14, 2017 at 10:22 pm #120695
Hi,
I was wondering if it’s possible to alter the WP query arguments of the search filter.
You see I add the search filter arguments to the general arguments;$args['search_filter_id'] = 71;
Which works perfectly. But these arguments have ‘posts_per_page => 9’. This display correctly.
See:
http://wbr.ikon.be/te-huur/
I also have a tab with a Google map that I would like to display all the results (not just 9 as is now the case; click the ‘Kaart’ tab on: http://wbr.ikon.be/te-huur/So for that I would need to alter the arguments of
$args['search_filter_id'] = 71;
by changing posts per page to => -1. I was wondering if this is somehow possible?
Setting the regular argument to'posts_per_page' => -1
doesn’t work because$args['search_filter_id'] = 71;
overrides it.Thanks in advance!
Anonymous(Private) July 15, 2017 at 11:48 am #120734Thanks for the quick reply.
But that would mean two different search forms. (one with posts_per_page = 9 and one with -1).
But the search is done on the homepage and the results displayed on the ‘te-huur’ page. I just need those same results for two different ‘tabs’ so the same results with ‘9’ and ‘-1’, but for that i need to alter the search form argument that sets it to ‘9’. If that is possible.Anonymous(Private) July 15, 2017 at 11:51 am #120736$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'order'=> 'ASC', 'orderby' => 'date', 'post_type' => 'panden', 'posts_per_page' => 9, 'meta_key' => 'status', 'meta_value' => array('Te huur', 'Te huur onder reservatie'), 'paged' => $paged); $args['search_filter_id'] = 71; $pandenLoop = new WP_Query($args);
I thought I would create a new WP_Query with those same arguments and just alter the ”posts_per_page’ => 9,’. But these are set in ‘$args[‘search_filter_id’] = 71;’ and I don’t know how to access those arguments.
posts_per_page' => 9
has no effect here because it take that argument from$args['search_filter_id'] = 71;
-
AuthorPosts