Skip Navigation

[Résolu] How to get title / values from taxanomies in php?

This support ticket is created Il y a 2 années et 8 mois. 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.

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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9: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: Africa/Casablanca (GMT+01:00)

This topic contains 4 réponses, has 2 voix.

Last updated by simonV-3 Il y a 2 années et 8 mois.

Assisted by: Jamal.

Auteur
Publications
#2143075

Tell us what you are trying to do? How can I show each single checkbox value and give them out as single element?

I have a multiple checkboxes field, and it is usable, that it's checked on more than one box. How can I do this?

I think I would like to use some custom code in php, but I don't know how to use the variables.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2143111

Jamal
Supporter

Languages: Anglais (English ) Français (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting Toolset support.

I believe that you opened a chat and disconnected from it before I could reply to you, right? If that's the case, please accept my apologies, I was also working on another case and I did not reply quickly.

Regarding your request, I am sorry but I don't think I understand. Is this about a "Checkbox" field, or about a "Checkboxes" field? Please note that those are different Toolset Fields. Check this screenshot hidden link

I assume it is the "Checkboxes" field. In this case, can you elaborate more on what would you mean by "How can I show each single checkbox value" And what do you mean by "give them out as single element?"
Can you provide an example or some screenshots?

#2143445

Dear Jamal

Yes, it is about the Checkboxes field. I try to explain what I like to achieve:

On a custom post type, more than one check of this checkboxes field are selected. I did set like this, that I get the "value" like

V, Vt, GF, DF etc out - but I not need them like this as I get them directly, I like to add some "css/html" around each value, like:

<div class="diettype">
<div class="mydiettype">V</div>
<div class="mydiettype">Vt</div>
<div class="mydiettype">GF</div>
<div class="mydiettype">DF</div>
</div>

This is what I like to see in html...

I found this: https://toolset.com/forums/topic/checkboxes-with-php/

But i am not sure if there is a better solution...

I would like to have a function in my custom code.

$checkboxes = types_field_meta_value('checkboxes');
foreach ($checkboxes as $value) {
if ( $value ) {
echo '[div class="checked"]' . $value . '[/div]';
} else {
echo '[div class="unchecked"]Not used[/div]' ;
}
}

Anything or elsewhere I can find it?

#2143677

Jamal
Supporter

Languages: Anglais (English ) Français (Français )

Timezone: Africa/Casablanca (GMT+01:00)

If you will have the checkboxes values wrapped in a static HTML code(vs dynamically changing the class), you can use the separator attribute of the types shortcode:

<div class="diettype">
    <div class="mydiettype">
        [types field="my-checkboxes" separator="</div><div class="mydiettype">"][/types]
    </div>
</div>

Does it makes sense?

If you want to generate dynamic classes for each value, you will definitely need custom code. If that's the case, let me know and I'll find out a solution.

#2143689

My issue is resolved now. Thank you!

I did it like this now:

<div class="mydiettypes">
<div class='res-circle'><div class='circle-txt'>[types field="eidosdiatrofis" separator="</div></div><div class='res-circle'><div class='circle-txt'>"][/types]</div></div>
</div>
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.