Home Forums Backend Issues (wp-admin) Multiple values for checkbox choices Reply To: Multiple values for checkbox choices

  • You could use multiple fields, probably in a repeater, where you supply all the information. For example a “URL” field, a link “Text” field and an field to enter the icon you want to use.

    Yes, I thought about that but I don’t want/need to input new information every time I create a post. The choices and their values should be pre-defined. Every time I choose “WordPress”, for instance, it should show the WordPress Icon followed by the word WordPress as a link on the front end. I can’t do that with the repeater field, can I?

    You could also code the icons and url into your template based on the values selected, but your code would need to supply the icon and the url information.

    That would be ideal and basically what I’m looking for. But how can I achieve this? Since the checkbox field can only provide one value per choice, I would have to find a way to check if that value matches a certain string and if so, prepend the code for the icon and wrap the value into the right link tag. I’m sure this would be possible with PHP, but I’m not that good at it and I’m pretty sure that it would lead to very long code in the template, right?

    If I would just have the option to assign the three variables icon word, url, and name to each choice and if it would provide those three values separately instead of just as one single value, then I could query these values and wrap them appropriately into i and a tags in the template.