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
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.
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.
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"]
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){
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!