Skip Navigation

[Resolved] Showing results for ""

This support ticket is created 5 years, 4 months 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by catrionaD 5 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1299473

Tell us what you are trying to do?

Showing results for "[x]"

1) where [x] is the text term searched. This is working fine:

<div class="resultsfor">Showing results for "[wpv-search-term param='wpv_post_search']"</div>

OR

2) where a quick link has been selected through the home page i.e. "Diabetes" "Domestic abuse" or "Mental health" hidden link

OR

3) where a Category drop-down has been selected from " - Select category" e.g. Crime. hidden link
> Showing results for "Crime"

and updated when a sub-category has been selected from " - Select sub-category" e.g. Burglary or robbery
> Showing results for "Burglary or robbery"

I had followed previous advice to fix 1, but is there a way I adjust the code to account for 2) and 3) please?

Thanks

#1299519

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1299587

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now. I've added the following JS code to your view's "Search and Pagination" section's JS box:
=> hidden link
Note: The full JS code you will see with "Search and Pagination" section's JS box as I cant able to paste here all the code.

jQuery(document).ready(function($){

  cat =  $.urlParam('wpv-relationship-filter-support-category'); 
 subcat =  $.urlParam('wpv-relationship-filter'); 
  
 if(cat!=0 && subcat !=0){
   cat_txt = $("#wpv_control_select_wpv-relationship-filter_support-category option:selected").html();
   subcat_txt = $("#wpv_control_select_wpv-relationship-filter option:selected").html();
   $(".resultsfor-cat h3").html("test display category "+cat_txt);	
   $(".resultsfor-subcat h3").html("test display sub-category "+subcat_txt);	
 }


});

I've also changed the div classes as given under:

<div class="resultsfor-cat"><h3> </h3></div>
<div class="resultsfor-subcat"><h3></h3></div>

As you can see now both category and sub-category title are displayed.

#1299607

Hi Minesh,

Thank you, that's great the titles are now displaying!

Do you know how I can arrange it so only one "Showing results for "[searchterm]"" is shown?

That is, either -

"Showing results for [wpv-search-term param='wpv_post_search'] OR ["resultsfor-cat"] OR ["resultsfor-subcat"]

#1300371

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What if you try to use the [wpv-conditional] shortcode:

For example:

[wpv-conditional if="( '[wpv-search-term param='wpv_post_search']' ne '' )"]
  Showing results for [wpv-search-term param='wpv_post_search']
[/wpv-conditional]


[wpv-conditional if="( '[wpv-search-term param='wpv-relationship-filter-support-category']' ne '' )"]
<div class="resultsfor-cat"><h3> </h3></div>
[/wpv-conditional]


[wpv-conditional if="( '[wpv-search-term param='wpv-relationship-filter']' ne '' )"]
<div class="resultsfor-subcat"><h3></h3></div>
[/wpv-conditional]

More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

Please Note that:
You may need to adjust the JS code I've added a little bit as you can see I used if condition and it displays the showing result for when both cat and subcat both are available - so you should change it accordingly:

if(cat!=0 && subcat !=0){
#1308057

Hi sorry I seem to have lost the code in a recent site revision.

Can you please re-insert what was there before?

Many thanks!