Forums › Forums › Search & Filter Pro › Edit Query Arguments and Pagination Problem
Tagged: arguments, edit, meta_query, pagination, query
- This topic has 14 replies, 3 voices, and was last updated 7 years, 3 months ago by Anonymous.
-
Ross Moderator(Private) July 13, 2017 at 6:55 pm #120478
Ah yes I found the issue.
Its the way you are doing the filter.
First of all let me say, when you use a WP filter, you usually get an input variable, which needs to be modified (filtered) and its then returned.
Doing
$args = array()
, means you replace the input object rather than modify it, for example this would be better:$args['property'] = "value"
Anyway, what it meant was, you were replacing the pagination variable, which had already been conveniently calculated for you ๐
So, all you would need to do is (notice I left
paged
off):$args['post_type'] = 'tarefa'; $args['posts_per_page'] = 5; $args['order'] = 'DESC'; $args['author'] = $feed_rc; $args['meta_query'] = $feed_cd;
In fact, now you are using the existing
$args
, you will find S&F builds a lot of the rest, just because of the settings you have chosen… so this could probably be reduced to:$args['author'] = $feed_rc; $args['meta_query'] = $feed_cd;
If you change the order of results in S&F settings this should be retained, as well as posts per page setting and post type ๐
Let me know how you get on!
Anonymous(Private) July 15, 2017 at 2:49 pm #120752Hi Ross!
Thank you very much, I think we are very close to find the solution! Pagination now is working and filtering too, but separately.
When filters are off, pagination works fine and adds ?sf_paged=2, ?sf_paged=3 to the end of URL. Like:
http://localhost/comunicacaodigital/minhas-tarefas/?sf_paged=2
When filters are on, pagination stops (stays on first page)… the pagination link is:
http://localhost/comunicacaodigital/minhas-tarefas/?_sfm_responsavel_1=47page/2
I did a test and manually type the URL like:
http://localhost/comunicacaodigital/minhas-tarefas/?_sfm_responsavel_1=47&sf_paged=2
And worked!
So do you have an idea of what I should do now?
Thanks again!
-
AuthorPosts