Hello,
I have created an archive for Search Results (see lien caché). I would like to get the search term into the search box and make it working properly. For searching I am using the zoom icon in the main menu. So is there any way how to put the term into box?
Hi Dave,
Thank you for contacting us and I'd be happy to assist.
From your message, I understand that you'd like to fill the search term in the search field on the top of the results when a regular WordPress search is performed.
( e.g. lien caché)
Screenshot: lien caché
To make this work, you can include the following script in your search archive's "JS Editor" tab.
( under the "Search and Pagination" section )
jQuery( document ).ready(function() {
var searchVal = jQuery('input[name="wpv_post_search"]').val();
var searchParam = jQuery('input[name="s"]').val();
if (searchVal == '') {
jQuery('input[name="wpv_post_search"]').val(searchParam);
}
});
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
yes, that´s what I wanted, thank you.
But there appeared an issue with styles. After the first search it is fine, but if you change the search term in box (e.g. akcie), the styling of the search results will broke as well as the search bar.
Hi Dave,
Thanks for the update and glad that the code snippet works.
To troubleshoot the difference in the syles, I'll need to see how this archive view is set up in the admin area.
Can you please share temporary admin login details?
Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.
regards,
Waqar
Hi Dave,
Thank you for sharing the admin access.
During troubleshooting, I discovered that the difference in the styles was a result of custom CSS styles included in the view "Vyhledávač investic".
The issue seems to be specific to the Divi theme and it doesn't matter if it is the first search or not. If the search results page, includes a result that uses a post view with custom CSS code, that CSS code is also loaded on the search results page.
Searching for "akcie" term ( lien caché ) includes the page "Investiční příležitosti" in the results while searching for "chalety", doesn't ( lien caché ).
I've shared these findings with the concerned team and will keep you updated with the progress through this ticket.
As a quick fix, you can either update your custom CSS code in the views, to include a scope, which makes them apply only when the view is used on a specific page or within a div/container with a specific class/ID or use a plugin like "Post/Page specific custom CSS" ( https://wordpress.org/plugins/postpage-specific-custom-css/ ), to load custom CSS, only on a specific page.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
thank you for discovering, where it comes from. I have disabled showing the problematical page with Relevanssi and wrote specific CSS to avoid problems in future.
But otherwise I would be happy, if this could be solved by Divi or by Toolset, so I will not close the ticket.
Hi Dave,
Thanks for writing back and our concerned team is investigating how this can be avoided and whether this will require some changes on the DIVI theme's end as well.
Either way, I'll keep you updated with the progress through this ticket and appreciate your report.
regards,
Waqar