eewee_display_setting

The Eewee responsive design eewee display setting function.

Description

eewee_display_setting( (array) $setting = array() ); 

Parameters (1)

0. $setting — Optional. (array) => array()
The setting.

Usage

  1. if ( !function_exists( 'eewee_display_setting' ) ) { 
  2. require_once '/includes/admin/theme-admin.php'; 
  3.  
  4. // The setting. 
  5. $setting = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = eewee_display_setting($setting); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/theme-admin.php  
  1. function eewee_display_setting( $setting = array() ) { 
  2. $options = get_option('eewee_options'); 
  3.  
  4. if ( ! isset( $options[$setting['id']] ) ) 
  5. $options[$setting['id']] = $setting['std'];  
  6.  
  7. switch ( $setting['type'] ) { 
  8.  
  9. case 'text': 
  10. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' type='text' value='". esc_attr($options[$setting['id']]) ."' />"; 
  11. echo '<br/><label>'.$setting['desc'].'</label>'; 
  12. break; 
  13.  
  14. case 'url': 
  15. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' type='text' value='". esc_url($options[$setting['id']]) ."' />"; 
  16. echo '<br/><label>'.$setting['desc'].'</label>'; 
  17. break; 
  18.  
  19. case 'textarea': 
  20. echo "<textarea id='".$setting['id']."' name='eewee_options[".$setting['id']."]' rows='5'>" . esc_attr($options[$setting['id']]) . "</textarea>"; 
  21. echo '<br/><label>'.$setting['desc'].'</label>'; 
  22. break; 
  23.  
  24. case 'html': 
  25. echo "<textarea id='".$setting['id']."' name='eewee_options[".$setting['id']."]' rows='5'>" . esc_attr($options[$setting['id']]) . "</textarea>"; 
  26. echo '<br/><label>'.$setting['desc'].'</label>'; 
  27. break; 
  28.  
  29. case 'checkbox': 
  30. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' type='checkbox' value='true'"; 
  31. checked( $options[$setting['id']], 'true' ); 
  32. echo ' /><label> '.$setting['desc'].'</label>'; 
  33. break; 
  34.  
  35. case 'multicheckbox': 
  36. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' type='hidden' value='true' />"; 
  37. foreach ( $setting['choices'] as $value => $label ) { 
  38. $checkbox = $setting['id'] . '_' . $value;  
  39. if ( ! isset( $options[$checkbox] ) ) 
  40. $options[$checkbox] = $setting['std'];  
  41.  
  42. echo "<input id='".$checkbox."'"; 
  43. checked( $options[$checkbox], 'true' ); 
  44. echo " type='checkbox' name='eewee_options[".$checkbox."]' value='true'/> " . $label . "<br/>"; 
  45. echo '<label>'.$setting['desc'].'</label>'; 
  46. break; 
  47.  
  48. case 'select': 
  49. echo "<select id='".$setting['id']."' name='eewee_options[".$setting['id']."]'>"; 
  50.  
  51. foreach ( $setting['choices'] as $value => $label ) { 
  52. echo "<option ".selected( $options[$setting['id']], $value )." value='" . $value . "' >" . $label . "</option>"; 
  53.  
  54. echo "</select>"; 
  55. echo '<br/><label>'.$setting['desc'].'</label>'; 
  56. break; 
  57.  
  58. case 'radio': 
  59. foreach ( $setting['choices'] as $value => $label ) { 
  60. echo "<input id='".$setting['id']."'"; 
  61. checked( $options[$setting['id']], $value ); 
  62. echo " type='radio' name='eewee_options[".$setting['id']."]' value='" . $value . "'/> " . $label . "<br/>"; 
  63. echo '<label>'.$setting['desc'].'</label>'; 
  64. break; 
  65.  
  66. case 'image': 
  67. echo "<p class='zee-image-bg'><img id='".$setting['id']."img' src='" . esc_attr($options[$setting['id']]) . "' /></p>"; 
  68. echo '<input class="zee-upload-image-field" id="'.$setting['id'].'" name="eewee_options['.$setting['id'].']" type="text" value="'. esc_attr($options[$setting['id']]) .'" />'; 
  69. echo '<input class="zee-upload-image-button button-secondary" type="button" value="'. __("Upload Image", "eewee") .'" />'; 
  70. echo ' <label>'.$setting['desc'].'</label>'; 
  71.  
  72. break; 
  73.  
  74. case 'fontpicker': 
  75. echo "<select id='".$setting['id']."' name='eewee_options[".$setting['id']."]'>"; 
  76. foreach ( $setting['choices'] as $value => $label ) { 
  77. echo "<option style='font-size: 1.3em; font-family: ".$value.";' ".selected( $options[$setting['id']], $value )." value='" . $value . "' >" . $label . "</option>"; 
  78. echo "</select>"; 
  79. echo '<br/><label>'.$setting['desc'].'</label>'; 
  80. echo "<div id='zee-font-bg' style='font-family: " . esc_attr($options[$setting['id']]) . ";'>Grumpy wizards make toxic brew for the evil Queen and Jack.</div>"; 
  81.  
  82. break; 
  83.  
  84. case 'colorpicker': 
  85. echo "#<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' class='colorpickerfield' type='text' maxlength='6' value='". esc_attr($options[$setting['id']]) ."' />"; 
  86. echo '<br/><label>'.$setting['desc'].'</label>'; 
  87. break; 
  88.  
  89. case 'fontsizer': 
  90. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' class='fontsizerfield' type='text' maxlength='2' value='". esc_attr($options[$setting['id']]) ."' /> pt"; 
  91. echo '<br/><label>'.$setting['desc'].'</label>'; 
  92. break; 
  93.  
  94. default: 
  95. echo "<input id='".$setting['id']."' name='eewee_options[".$setting['id']."]' size='40' type='text' value='". esc_attr($options[$setting['id']]) ."' />"; 
  96. echo '<br/><label>'.$setting['desc'].'</label>';