Skip Navigation

[Waiting for user confirmation] I would like to trim the label output of wpv-control-post-taxonomy type=radios

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 2 replies, has 1 voice.

Last updated by Minesh 2 hours, 10 minutes ago.

Assisted by: Minesh.

Author
Posts
#2845517
Screenshot 2026-01-28 134757.jpg
Screenshot 2026-01-28 134834.jpg

I'm using the short code from here
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-control-post-taxonomy
[wpv-control-post-taxonomy taxonomy="category" type="radios" url_param="wpv-category"]

I'm attempting to turn radio button, into actual buttons, to make a more pleasing filter.
hidden link
pass: test

I've already used CSS to change the look, and that works fine, However I would like the buttons to have only the category names without the non breaking spaces and the dashes

So... where the button label is now "    ---Renters"
I would like it to be simply
"Renters"

Any pointers as to how to modify the output would be greatly appreciated.

#2845595

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please send me admin access details and let me check what will be the possible solution in this case.

*** 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.

#2845637

Minesh
Supporter

Languages: English (English )

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

With your view I've added the following custom JS code to "Search and Pagination" section's "JS Editor":
=> hidden link

function remove_dashes_from_radio_options() {
  
  jQuery('#topicsearch label').each(function () {
  jQuery(this).html(function (_, html) {
    return html.replace(/( )+—/g, '').replace(/( )+–/g, '');;
  });
});
   
}
 
// Run once on page load
jQuery(document).ready(function() {
    remove_dashes_from_radio_options();
});
 
// Run again after AJAX updates the filter
jQuery(document).on('js_event_wpv_parametric_search_results_updated js_event_wpv_parametric_search_form_updated', function() {
    remove_dashes_from_radio_options();
});

Can you plese confirm it works as expected.