Forums › Forums › Search & Filter Pro › Pagination
Tagged: pagination, posts_per_page
- This topic has 1 reply, 2 voices, and was last updated 6 years, 2 months ago by Trevor.
-
Anonymous(Private) August 24, 2018 at 7:43 pm #186479
Hello,
So I have a 3 part question, but first will explain how I’m using S&F.
On my blog, I currently have a full width featured post, which I’m pulling in using WP_Query based on a ACF field value. So this is outside of the results.php (well [id#].php) loop.
Then below the featured post, I’m using S&F to load the rest of my posts. The filter select fields are at the top of the page.
So my first issue is when the user clicks on “older posts” pagination link at the bottom, I want to hide the featured post at the top of the page. Normally if the 2nd page of results wasn’t being loaded by ajax, I could use is_paged() or !is_paged() to conditionally load the featured post. But that obviously doesn’t work because it’s only doing a partial page reload. So do you know of anyway to hide an element outside the loop if not on the first page of results….when using ajax? I was hoping there was more elegant way of doing this other than using jquery to hide based off of the URL’s query string parameters.
My second issue is more of why is this happening rather than how I do I do this as with my first issue.
In the results template there are two pagination being loaded, one before the results and one after. The design only shows it having pagination on the bottom of the results, so I took out the first. The issue is when I click on “older posts” it jumps me down to the bottom of the page. If I scroll back up, I can see the 2nd page of results.
Now if I move pagination before the results, it works fine and keeps me where I’m at on the page. It’s if the pagination is after (below) the results that it automatically drops me to the bottom of the page where the results are out of view.
Finally, I was wondering if there is a way to show X number of posts on the first page of results, but then show Y number of results on the rest of the paginated pages? My first page has certain elements that I will removing on pagination pages, so if I go with the number of posts that I want to show on my first page, then the page will look a bit sparse on the older posts pages.
Thanks!
Trevor(Private) August 28, 2018 at 11:35 am #186559I will take these in a different order.
I was wondering if there is a way to show X number of posts on the first page of results, but then show Y number of results on the rest of the paginated pages? My first page has certain elements that I will removing on pagination pages, so if I go with the number of posts that I want to show on my first page, then the page will look a bit sparse on the older posts pages.
Stackexchange has a few threads discussing this in general for WordPress, but I am not sure any of the solutions would work when combined with our search, as they are quite complex. It works around using an offset:
https://wordpress.stackexchange.com/questions/155758/have-different-number-of-posts-on-first-page
This coding is way outside of our support plan though.
… do you know of anyway to hide an element outside the loop if not on the first page of results….when using ajax? I was hoping there was more elegant way of doing this other than using jquery to hide based off of the URL’s query string parameters.
I do not. jQuery is the only way I can think of doing it.
In the results template there are two pagination being loaded, one before the results and one after. The design only shows it having pagination on the bottom of the results, so I took out the first. The issue is when I click on “older posts” it jumps me down to the bottom of the page. If I scroll back up, I can see the 2nd page of results.
This must be your theme doing this, or another plugin, as it normally would go to the top of the Ajax Container. You could use jQuery to scroll the page back to the top of the container after ajaxfinish.
-
AuthorPosts