Skip Navigation

[Resolved] I want to display select field "display name" instead of "value" in my front end

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 1 reply, has 1 voice.

Last updated by michelleJ 7 years, 3 months ago.

Author
Posts
#478445
Screen Shot 2017-01-16 at 5.04.47 PM.png

I am trying to: display on the front end the option Display Text instead of its value (or rather in addition to its value). The value is actually an image link, and the name is name of the team whose logo is the image. I need to display both in separate locations and would love not to have to create a second dropdown to select team name, since its already associated with the logo image in the intial dropdown as the display text.

I am using this code to display the image:

 <?php  $team =types_render_field("mlb-club", array('raw' => true)); if ($team=='N/A') { 
        echo(types_render_field("mlb-club", array('raw' => true))); 
		} else { ?>
        
        <img src="<?php
                                                echo(types_render_field("mlb-club", array('raw' => true)));
                                                ?>" style="width:100%;height:auto;max-width:100px;" alt="<?php
                                                echo(types_render_field("mlb-club", array('raw' => true)));
                                                ?>" /><div style="float:left;width:1px;height:1px;visibility:hidden;"><?php
                                                echo(types_render_field("mlb-club", array('raw' => true)));
                                                ?></div><?php }; ?>

I also need to display the option "Display Text" of the image/team name (see screenshot):

Is this possible? It should be in the array for that select field, right? How might I call for that?

Thanks!

#478459

I submitted this to the professional support forum since this one showed up in pre-sales questions, so I'll mark this version resolved.

I did manange to half solve this, by getting the custom select field display name and option name to display. However, I need just the option name, and not the select field name to show.

But what I did to get it to show select field name and options name is:

<?php echo(types_render_field("mlb-club", array('show_name' => 'true'))); ?>

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.