Home › Forums › Legacy Support › Support queries › Setup issues › Custom field radio button
Tagged: custom field
- This topic has 2 replies, 2 voices, and was last updated 7 years, 11 months ago by Anshuman Sahu.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
December 27, 2016 at 9:02 am #87015arinaSpectator1) Hi, when I add a custom field, it will automatically set to text field. How do I change the type to radio button & where can I add the field for the radio button? 2) The custom field only appears in admin front end. How can I enable it in instructor front end?December 28, 2016 at 12:13 pm #87152Anshuman SahuKeymasterPlease follow this tip to add custom field in course : https://wplms.io/support/knowledge-base/adding-custom-field-in-course-setting/ This is an example to add a text field named custom in course settings similarly you can add radio field like this : add_filter('wplms_course_metabox','custom_fileds'); function custom_fileds($field1){ $prefix = 'vibe_'; $field1[]=array( // Text Input 'label' => __('Custom item menu','vibe-customtypes'), // <label> 'desc' => __('Put description','vibe-customtypes'), // description 'id' => $prefix.'field1', // field id and name 'type' => 'yesno', // type of field 'options' => array( array('value' => 'H', 'label' =>__('Hide','vibe-customtypes')), array('value' => 'S', 'label' =>__('Show','vibe-customtypes')), ), 'std' => 'H' ); return $field1; } To add custom fields in assignment,course,product,page,post just change this line : add_filter('wplms_course_metabox','custom_fields'); change the " course " to post,page,wplms-assignment,product etc .December 28, 2016 at 12:27 pm #87154Anshuman SahuKeymaster2. for front there is a different filter . Try adding this code for adding custom fields in front end course edit : add_filter('wplms_course_creation_tabs','switch_wplms_front_end_tabs12',1); function switch_wplms_front_end_tabs12($settings){ $fields = $settings['course_settings']['fields']; $arr=array(array( 'label'=> __('custom','wplms-front-end' ), 'text'=>__('custom','wplms-front-end' ), 'type'=> 'switch', 'options' => array('H'=>__('NO','wplms-front-end' ),'S'=>__('YES','wplms-front-end' )), 'style'=>'', 'id' => 'vibe_custom', 'from'=> 'meta', 'default'=>'H', 'desc'=> __('custom','wplms-front-end' ) )); array_splice($fields, (count($fields)-1), 0,$arr ); $settings['course_settings']['fields'] = $fields; return $settings; }
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘Custom field radio button’ is closed to new replies.