- This topic has 2 replies, 2 voices, and was last updated 7 years, 12 months ago by
pupppet.
Viewing 2 reply threads
-
AuthorPosts
-
-
February 11, 2014 at 1:17 am #1361
pupppetMemberSearched the heck out of this one but no dice- How do I test if a checkbox option has been selected?
This is the only help I’ve found on using fields but there’s nothing on checkboxes- http://piklist.com/user-guide/tutorials/building-settings-pages/.
-
February 11, 2014 at 2:44 pm #1365
-
February 11, 2014 at 5:02 pm #1367
pupppetMemberYup but I’m looking to test if a checkbox value has been checked off, not a radio, so the results will be in an array and I didn’t see an example that pulled values from an array (I could have just missed it, my apologies if so!)-
piklist('field', array( 'type' => 'checkbox' ,'field' => 'theme_regions' ,'label' => __('Active Regions:') ,'description' => __('') ,'value' => '' ,'choices' => array( 'hero' => 'Hero' ,'layout_above' => 'Above Layout' ,'content_above' => 'Above Content' ,'content_below' => 'Below Content' ,'layout_below' => 'Below Layout' ) ));This wordy thing is what I settled on but I figured there’s a better way…
if (($theme_options['theme_regions'] == 'hero') OR (is_array($theme_options['theme_regions']) && (in_array("hero", $theme_options['theme_regions'])))) { ... }
-
-
AuthorPosts
Viewing 2 reply threads
- You must be logged in to reply to this topic.