-
Search Results
-
Topic: Pagination
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!
Topic: Customizing Search Form
I know I’m able to customize the results template by creating a folder in my theme called search-filter and then placing results.php (or changing name to ID of form). I’m all good with that part. I was wondering if there was a way to update the search form’s outputted HTML? My goal is to remove the form fields from an unordered list and use divs with grid and cell classes (Foundation XY Grid). I know I can write a bunch of overriding css, but was hoping there was a way to just change the outputted html instead.
Any advice would be greatly appreciated.
Hi – I am attempting to display the searched text term in the results.php file but cant seem to get it to appear…
I was thinking this should work:
You searched for <?php echo $sf_current_query; ?>. Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />But it doesn’t fetch the search term…?
I’m trying to recreate a grid type archive page for my search & filter results similar to this page (https://miamicirclemarble.com/browse-inventory/). I followed the instructions here (https://searchandfilter.com/documentation/search-results/using-a-shortcode/) to start the process of building this page. But my results are not updating. I deleted the excerpt, date, and category, and moved the featured image above the title. But no changes can be seen on my results page. I put the customized results.php file in this folder- wp-content / themes / headwaychild / search-filter / results.php. What am I doing wrong?