diff --git a/functions.php b/functions.php index 81a2efc8..7526319a 100644 --- a/functions.php +++ b/functions.php @@ -36,6 +36,11 @@ function _s_setup() { */ //require( get_template_directory() . '/inc/tweaks.php' ); + /** + * Custom Theme Options + */ + //require( get_template_directory() . '/inc/theme-options/theme-options.php' ); + /** * WordPress.com-specific functions and definitions */ diff --git a/inc/theme-options/theme-options.php b/inc/theme-options/theme-options.php new file mode 100644 index 00000000..88691096 --- /dev/null +++ b/inc/theme-options/theme-options.php @@ -0,0 +1,316 @@ + array( + 'value' => '0', + 'label' => __( 'Zero', '_s' ) + ), + '1' => array( + 'value' => '1', + 'label' => __( 'One', '_s' ) + ), + '2' => array( + 'value' => '2', + 'label' => __( 'Two', '_s' ) + ), + '3' => array( + 'value' => '3', + 'label' => __( 'Three', '_s' ) + ), + '4' => array( + 'value' => '4', + 'label' => __( 'Four', '_s' ) + ), + '5' => array( + 'value' => '3', + 'label' => __( 'Five', '_s' ) + ) + ); + + return apply_filters( '_s_sample_select_options', $sample_select_options ); +} + +/** + * Returns an array of sample radio options registered for _s. + * + * @since _s 1.0 + */ +function _s_sample_radio_buttons() { + $sample_radio_buttons = array( + 'yes' => array( + 'value' => 'yes', + 'label' => __( 'Yes', '_s' ) + ), + 'no' => array( + 'value' => 'no', + 'label' => __( 'No', '_s' ) + ), + 'maybe' => array( + 'value' => 'maybe', + 'label' => __( 'Maybe', '_s' ) + ) + ); + + return apply_filters( '_s_sample_radio_buttons', $sample_radio_buttons ); +} + +/** + * Returns the default options for _s. + * + * @since _s 1.0 + */ +function _s_get_default_theme_options() { + $default_theme_options = array( + 'sample_checkbox' => 'off', + 'sample_text_input' => '', + 'sample_select_options' => '', + 'sample_radio_buttons' => '', + 'sample_textarea' => '', + ); + + return apply_filters( '_s_default_theme_options', $default_theme_options ); +} + +/** + * Returns the options array for _s. + * + * @since _s 1.0 + */ +function _s_get_theme_options() { + return get_option( '_s_theme_options', _s_get_default_theme_options() ); +} + +/** + * Renders the sample checkbox setting field. + */ +function _s_settings_field_sample_checkbox() { + $options = _s_get_theme_options(); + ?> + + + + + + + + +
+ +
+ + + + +
+ +

+ + +
+ +
+
+