I'm trying to have a contained text search filter for the base Post archives from within a WordPress Archive built within Toolset, however the search results return posts that fulfill the search query that are not just Posts. This is not what I'm looking to have happen in the Blog Post archive.
While this normally isn't a problem in a proper View, as Views inherently filter output based on the post type (or taxonomy) that is configured in the View, since I'm using a WordPress Archive that is associated with a Layout, it doesn't let me restrict the archive view to post type.
Hello,
The Toolset Layouts plugin was retired and had been moved to Legacy plugins, it is not recommended to use it in your new project.
We recommend to use the Toolset Blocks plugin to design your website archive page, see our document:
https://toolset.com/course-lesson/creating-a-custom-archive-page/
If you insist on Layouts plugin, you can use WordPress built-in action hook pre_get_posts to setup the post type parameter, see WP document:
https://developer.wordpress.org/reference/hooks/pre_get_posts/
I'm not sure how I'd be able to use this action hook for my application. Any help in the integration of pre_get_posts would be greatly appreciated.
Regarding the use of Toolset Layouts, we've been waiting until all the features of Layouts and Views have been incorporated into Blocks. Without the features that we've come to rely on from these two "legacy" plugins, we simply cannot switch to Blocks.
I'd also like to point out that Toolset's WordPress Archives are still a feature of Toolset Blocks, and much of that same functionality that is in question is present in Toolset Blocks.
That said, is the issue a matter of association with the WordPress Archive being tied directly to a post type archive Layout (as per the legacy integration)?
It needs custom codes, please provide a test site with the same problem, also point out the problem page URLs, I need to test and debug it in a live website, thanks
Thanks for the details, I can login into your website, and I assume we are talking about WordPress Archive "Blog Posts Archive":
lien caché
I have tried to display the post type in frontend, with below codes:
Post type: [wpv-post-type]
Where and how can I see the search results "are not just Posts"?
Please provide detail steps to reproduce the same problem, thanks
Oh sorry. Yes the general blog post archive, labeled as "News" from the frontend. Here is a link with a search query tied to a URL parameter.
lien caché
I also attached a screenshot to illustrate which post is appearing that shouldn't be. This archive should only output the generic "News/Blog" Posts.
Let me be absolutely clear, we do have a generic search archive, that we use for all post types, so we've left those options open in Relevanssi, otherwise I would have just restricted it that way. I imagine it's the Relevanssi settings that are getting in the way of the proper filtration of this WordPress Archive "view."
I have tried these in your website:
1) Edit the WordPress Archive "Blog Posts Archive"
lien caché
in section "Loops Selection", click "Edit" button of option "Home/Blog", enable option "Posts", and save
2) Test the URL you mentioned above:
lien caché
It works fine, I see only posts
Please check if it is fixed, thanks
Yeah, I thought that's what I did. I specifically created a brand new WordPress Archive so that I could specifically select the post types and archives in the Loop Selection configuration, but at the time, it didn't appear to make a difference.
Well, now it's clearly working. Thank you for your assistance.
I have tried again in your website:
lien caché
It works fine, I see only posts
Is this problem resolved?
If there is new issue in new WordPress Archive, please point out the problem page URLs
This is indeed resolved. Thank you.