Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.17, custom, field, radio group, template
- This topic has 2 replies, 2 voices, and was last updated 10 years, 2 months ago by
Brittany V.
-
AuthorPosts
-
06/15/2016 at 4:25 pm #379610
Brittany V
GuestHi Steven –
I’ve created a radio button group in a custom metabox on the Add/Edit entry page.
$identifyingAtts = array( 'title' => 'Identifying Information', // Change this to a name which applies to your project. 'id' => 'identifying_information', // Change this so it is unique to you project. 'context' => 'normal', 'priority' => 'core', 'fields' => array( array( 'name' => 'Death Classification', 'show_label' => TRUE, 'id' => 'death_classification_radio_group', 'type' => 'radio_inline', 'options' => array( 'line_of_duty_death' => 'Line of Duty Death', 'performance_of_duty_death' => 'Performance of Duty Death', 'military_service_death' => 'Military Service Death', ), ), ), ); cnMetaboxAPI::add( $identifyingAtts );The radio button group is displayed fine in the metabox & I’m able to properly store a selection from that radio group in each entry. I’m having a hard time displaying the value of the selected radio button on the SlimPlus template.
The only data that is returned to me is the “key” (
line_of_duty_death,performance_of_duty_death, andmilitary_service_death) of the selected item. I can’t get the value portion of the radio button group (id =deat_classification_radio_group).Any idea how I could modify the way that I’m retrieving the meta-data for an entry to display the value of the radio button? (not the key)
In template override I pull the meta data for the radio button group like so:
$deathClassification = $entry->getMeta( array( 'key' => 'death_classification_radio_group', 'single' => TRUE ) );06/16/2016 at 9:06 am #379712Steven Zahm
Keymaster@ Brittany
Sounds like it working perfectly, you should receive the
keyname of the radio option that was chosen. You template code should be something like this:$deathClassificationOptions = array( 'line_of_duty_death' => 'Line of Duty Death', 'performance_of_duty_death' => 'Performance of Duty Death', 'military_service_death' => 'Military Service Death', ); $deathClassification = $entry->getMeta( array( 'key' => 'death_classification_radio_group', 'single' => TRUE ) ); if ( in_array( $deathClassification, $deathClassificationOptions ) ) { echo esc_html( $deathClassificationOptions[ $deathClassification ] ); }Hope that helps!
06/16/2016 at 12:21 pm #379730Brittany V
GuestThat solved it. Thank you! was also able to add some custom code to import the key of the radio button needing to be selected for different entries when using the CSV importer.
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
