Skip Navigation

[Resolved] Question about custom taxonomies – radio buttons instead of checkboxes?

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 10 replies, has 2 voices.

Last updated by lesleeM 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2553607

Is it possible to create a taxonomy that will use radio buttons instead of checkboxes on the edit [custom content type] page? We have set up a taxonomy with Yes or No options to act as a query filter to limit display of Rides in a view to those rides where the Yes option is selected with the taxonomy. But on the edit screen, the possibility is there to choose both Yes and No on this taxonomy because they are checkboxes. It would be better if the person editing the page could only choose Yes or No but not both.

Please let me know if this is possible. It's not terrible if it can't be done because we can just provide instructions to anyone that will be editing rides to make sure to check only one of these options. I was just hoping to avoid any possibility for confusion on this.

I have found this plugin:

https://wordpress.org/plugins/select-all-categories-and-taxonomies-change-checkbox-to-radio-buttons/

I don't know if that would work if you don't have a solution. Please advise with your thoughts on this possibility if necessary.

#2554013

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I checked the following plugin and it does display the taxonomy term as radio buttons on post edit screen. Maybe you should try to use the following plugin that should work.
- https://wordpress.org/plugins/radio-buttons-for-taxonomies/

#2554193

I tried the plugin you suggested and I'm seeing one problem that will cause confusion. We named the taxonomy "Add To Ride Maps Page". My two options on the taxonomy are Yes and No. We assigned the Taxonomy to the Ride content type. But on the Add New Ride page, this plugin did change the options to radio buttons as expected, but instead of showing only the defined options, it has added a third option called "No Add To Ride Maps Page"

So we have three options showing as:

Yes
No
No Add To Ride Maps Page

I did find instructions in the plugin FAQ for eliminating this unwanted extra option, but those instructions didn't work. I've now filed another support ticket with that plugin author. I think she'll be able to figure out if I'm doing something wrong.

But if I can't get rid of it, I think this added field is going to cause confusion. It won't be problematic for functionality, but it just seems weird. I think the problem here is that there is this third option of not selecting either option and it is calling no selection by this name. It is defaulting to this No Add To Ride Maps Page option being selected. I was thinking I might be able to make this third option go away if I make the taxonomy selection required, but I'm not sure where to do that. Is there a way to do that?

I also looked to see if there was a way to make the default selection the "No" option. I'm not seeing any way to do that either. The only setting this plugin provides is to define which taxonomy or taxonomies get converted to radio buttons. I'm asking these questions regarding the Toolset side of the equation where the taxonomy is set up.

#2554277

Minesh
Supporter

Languages: English (English )

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

The thing is that the plugin I shared is just for reference. We can not decide what feature other plugins are offered. You may also try to search for other plugin and check and test if that serves what you required as Toolset simply do not offer such feature to convert taxonomy terms checkboxes to radio buttons.

#2554417

Understood fully there. I could always just delete MY "No" option and use the extra option their plugin added as the "No" field. I just can't change the name of the field away from "No Add To Ride Maps Page" I think they'll get me the help needed though. I think the author of this plugin is the same as another plugin I've used before where their support was very good. I just have to wait for further replies. She had me try something else and that didn't work either. I let her know that the taxonomy was created through Toolset. I don't know if that makes a difference, but none of her supplied code to eliminate this unwanted additional option the plugin is generating has worked so far.

Is there any way to set a default option with your custom taxonomies? Is there any way to make a selection on the taxonomy required? Feel free to split this reply into another ticket if need be.

#2554447

Another thought. I could just make this a regular field added to the field group for this content type. I know with that I'd be able to set it to be a radio button, set it to be required and set a default option.

The only reason I set it up as a taxonomy is because I previously had a difficult time getting a query filter or conditional output to work right with a regular field with something I was doing before and it was suggested to make it a taxonomy instead. That worked very well and very easily, so I'm in the habit of making things like this into a taxonomy now.

#2554793

Minesh
Supporter

Languages: English (English )

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

Finally - what way you would like to go, you have to decide and we are happy to help with either taxonomy way or custom radio field as well.

Can you decide what way you would prefer?

#2554805

Here is the support ticket filed with the plugin you steered me to.

https://wordpress.org/support/topic/unable-to-hide-the-no-taxonomy-name-option/

In addition to the unwanted option being added by this plugin, I now also see that it doesn't save properly with this plugin enabled when I try to set up the Query Filter. When I disable this plugin and use checkboxes, the Query Filter saves properly. The plugin author has indicated there must be a conflict of some kind there that she wouldn't be able to solve. So I think this plugin is ruled out on that basis. I've told her I'd bring it up to you and asked if she'd be willing to assist if you are willing to look at it. I'm not sure if you'd want to do so.

Right now, I'm going to try the plugin I found and see what it does. If that fails, then I'll go ahead with making this a regular field instead of a taxonomy and see if I can get a query filter set up to work based on a Yes option selection on that field. More in my next response.

#2554813

Hey! The plugin I found worked perfectly. So if you have someone pose this question in the future, have them use this one instead:

https://wordpress.org/plugins/select-all-categories-and-taxonomies-change-checkbox-to-radio-buttons/

I'll let you know if I see any problems with using it in conjunction with Toolset Query Filters going forward.

#2555009

Minesh
Supporter

Languages: English (English )

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

Ok great - you are welcome to close the ticket if everything is sorted related to this ticket.

#2556229

My issue is resolved now. Thank you!