Forums › Forums › Search & Filter Pro › Issues when using hook for arguments
- This topic has 3 replies, 2 voices, and was last updated 7 years, 9 months ago by
Anonymous.
-
Anonymous(Private) January 29, 2019 at 5:09 pm #200503
Hey Trevor,
Thanks for trying to help me this am. I have implemented the hook in functions php but it has brought on other issues now.
Issue #1 –
Current page is not recognized. So when you click page 2, it does bring load page 2 via ajax but the “current” class is not applied to the number 2 in pagination. So “1” is still treated as the current page from css standpoint thus to the user it looks like they are on page 1.Issue #2 –
The goal is for the homepage to display shows today and in future. But for the user to be able to search for all shows past and present. This is how I successfully had it set up at first. When using the below function, yes the homepage only displays shows in the future when you initially load the page but it also makes it so you can not search shows in the past. Again, the goal is for home page to display today and future shows but for the user to be able to search both past and future.function include_exclude_search_filter( $query_args, $sfid ) {
`//if search form ID = 1113, the do something with this query
if($sfid==1113)
{
//modify $query_args here before returning it
$query_args[‘meta_query’] = array(‘relation’ => ‘AND’,
array(
‘post_type’ => ‘show’,
‘posts_per_page’ => 12,
‘max_num_pages’ => 99999,
‘meta_key’ => ‘show_date’,
‘order’ => ‘ASC’,
‘orderby’ => ‘meta_value’,
),
array(
‘key’ => ‘show_date’,
‘compare’ => ‘>=’,
‘value’ => $today,
),
);
}
elseif($sfid==1234)
{}
return $query_args;
}
add_filter( ‘sf_edit_query_args’, ‘include_exclude_search_filter’, 20, 2 );`Anonymous(Private) January 29, 2019 at 6:06 pm #200527Thanks Trevor – the second point is very important to what I am trying to build so I guess I will need to stay with using an archive page. At the moment, the archive page method is working perfectly for what I need it to do. I know its probably luck as you mentioned lol but I will just roll with it for now. In that case, sticking with the archive page method also relieves the first issue of existing as well 🙂 So all good.
-
AuthorPosts