B
B
bro-dev2016-02-29 23:33:26
Web development
bro-dev, 2016-02-29 23:33:26

How to make pagination according to your selection?

So I filtered my selection . I
$query = new WP_Query( $args );
brought out all the ambassadors on it and then pagination
the_posts_pagination();
. As I understand it, it works on a global selection and always displays pages even if there is 1 element in the selection. How to make her actually friends with my sample?
Or am I doing something wrong at all and should I filter posts differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2016-03-04
@HeadOnFire

Nothing is clear :)
If I understand correctly, the default query remains on the page, but besides it, a secondary query (WP_Query) is also used, and you want pagination to be based on the secondary query, and not the main one?
Then yes, you are doing it wrong. Pagination is tied to the main query. You need to change it through the pre_get_posts hook, instead of creating a secondary request. If the page is such that a secondary request for another type of content is inevitable, then it is necessary to request just secondary content in it that does not require pagination.
Clarify the question and show the code, then it will be easier to help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question