Skip Navigation

[Escalated to 2nd Tier] Search term in Search Results

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Waqar 5 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1355331

Hello,

I have created an archive for Search Results (see hidden link). 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?

#1355437

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. hidden link)

Screenshot: hidden link

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

#1355725

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.

#1355825

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

#1356709

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 ( hidden link ) includes the page "Investiční příležitosti" in the results while searching for "chalety", doesn't ( hidden link ).

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

#1357877

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.

#1357951

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