Byrne Theme: Search widget only returns 4 posts
-
I recently activated the premium Byrne theme on our website and, after getting to grips with the Block Editor, I’m really pleased with the flexibility of the design.
However, the Search widget (which is displayed in the Header section) only returns 4 posts – whatever search terms are used – with no ‘Load more’ option to view additional results. We have 438 posts in total so not being able to use the Search function makes finding a particular article very difficult.
The website in question is: retrospectjournal.com.
We have the Premium package and so I’m limited in the changes I can make to the theme. Any advice on what might be causing this issue and how to rectify it would be much appreciated!
The blog I need help with is: (visible only to logged in users)
-
So, immediately after posting this query (as is always the case!) I discovered that changing the settings to display more posts per page shows more search results. However, this effects the number of posts shown on each Category page, accessed via the drop down menu ‘Latest Articles’.
Is there any way to ensure that the Search widget returns all results without affecting the other pages, or will I just have to set the ‘Posts per page’ number to sufficiently high a value to make sure all results are returned?
-
Hi there,
At the moment this isn’t possible.
The setting to display x posts per page in Settings ->Writing has always been a global setting in WordPress, that applies to the main posts page, archive pages and search results, so changing that setting applies it to all those different pages. So there’s not currently a way to have that set to different values for different pages.
But you should be able to add a way to load more posts on the Search results page:
Go to Appearance ->Editor. Click the template name at the top, and click Browse All Templates. Select the Archive template.
When that template loads in the editor, click the three horizontal lines top left to open the block list. Expand the blocks listed there to see the blocks making up that template. What I specifically want you to see is the Group block, nested under the Query Loop block, containing the pagination blocks:
That’s what lets you load more posts on the category archive pages. So to also be able to load more posts on the Search result page, you need to replicate those blocks on the Search template.
So now click the template name at the top again, and select the Search template. Open the block list again, and under the Query Loop block, create a new group block containing those pagination blocks. Save that template, and you should be good to go.
We have the Premium package and so I’m limited in the changes I can make to the theme.
As you’re using a new block theme, you can actually modify most of your theme without needing to use any code or plugins at all – the site editor allows you to customize templates for all the different types of content on your site, and even lets you create your own custom templates if you want. You can find more details on how it works here:
https://wordpress.com/en/support/site-editor/
I mentioned the Query loop block above – on any page on your site that displays posts, i.e. the main posts page (Index template), category pages (Archive template) and search result pages (Search template), you’ll find that block.
As I explained above, at the moment that block follows the global site setting for the number of posts to display. But there is a feature request open on WordPress.org to add a custom post count setting for that block, so this is something you’ll hopefully have more control over in a future version of WordPress.
You can find more details on using the Query Loop block here:
https://wordpress.com/en/support/full-site-editing/theme-blocks/query-loop-block/
Let me know if you have any questions about this.
-
That’s exactly what I was looking for, thank you for your help and advice! I had a bit of difficulty at first when trying to add a new block as searching for ‘Pagination’ brought up no results. However when I removed the Group that the Query Loop was nested in, that seemed to do the trick and I’ve been able to add it. I hadn’t realised I could change each template individually like that, so that’s fantastic.
Many thanks again – problem is now solved!
- The topic ‘Byrne Theme: Search widget only returns 4 posts’ is closed to new replies.