Previously I wrote a tutorial “How to change the footer copyright text from Genesis Theme Settings Page“. Today I am writing this article and showing you how to change the footer widget area from Genesis Theme Settings page. I added following PHP code in functions.php file: Creating Theme Settings for Footer Widget
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
function gd_defaults_settings_fields( $default_settings ) { $default_settings['footer_widgets'] = 3; // default is 3 return $default_settings; } add_filter( 'genesis_theme_settings_defaults', 'gd_defaults_settings_fields' ); function gd_genesis_settings_sanitization_filters() { genesis_add_option_filter( 'no_html', GENESIS_SETTINGS_FIELD, array( 'footer_widgets' ) ); } add_action( 'genesis_settings_sanitizer_init', 'gd_genesis_settings_sanitization_filters' ); add_action('genesis_theme_settings_metaboxes', 'gd_add_metaboxes', 99, 1); function gd_add_metaboxes( $pagehook ){ if( is_admin() ): add_meta_box( 'genesis-theme-settings-footer-widgets', __( 'Footer Widget Settings', 'genesis_developer' ), 'gd_footer_widgets_box', $pagehook, 'main', 'high' ); endif; } // Footer Widgets UI function gd_footer_widgets_box(){ ?> <p> <label for="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]"><?php _e( 'Footer Widgets:', 'genesis' ); ?></label> <select name="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]" id="<?php echo GENESIS_SETTINGS_FIELD;?>[footer_widgets]"> <?php for($i=0; $i <= 6; $i++){ ?> <option value="<?php echo $i; ?>"<?php selected( $i, genesis_get_option( 'footer_widgets' ) ); ?>><?php echo $i; ?></option> <?php } ?> </select> </p> <?php } |
Adding Footer… Continue Reading