options = $this->get_theme_options()) ) add_option( TXTDOM.'_theme_options', $this->options = $this->default_theme_options() ); register_setting( TXTDOM.'_options', // Options group, see settings_fields() call in twentyeleven_theme_options_render_page() TXTDOM.'_theme_options', // Database option, see twentyeleven_get_theme_options() array(&$this, 'theme_options_validate') // The sanitization callback, see twentyeleven_theme_options_validate() ); // Register our settings field groups add_settings_section( 'general', // Unique identifier for the settings section '', // Section title (we don't want one) '__return_false', // Section callback (we don't want anything) 'theme_options' // Menu slug, used to uniquely identify the page ); // Register our individual settings fields // General section add_settings_field( 'col1', // Unique identifier for the field for this section 'Colore principale', // Setting field label array(&$this, 'color_col1'), // Function that renders the settings field 'theme_options', // Menu slug, used to uniquely identify the page 'general' // Settings section. Same as the first argument in the add_settings_section() above ); add_settings_field('bio', 'Bio autore', array(&$this, 'bio_field'), 'theme_options', 'general'); add_settings_field('copyrightArea', 'Piè di pagina', array(&$this, 'copyrightArea_field'), 'theme_options', 'general'); add_settings_field('albo', 'Albo Pretorio', array(&$this, 'albo_field'), 'theme_options', 'general'); add_settings_field('avcp', 'AVCP', array(&$this, 'avcp_field'), 'theme_options', 'general'); // Load default values } // init function enqueue_scripts ( $hook ) { if( 'appearance_page_theme_options' != $hook ) return; wp_enqueue_script( TXTDOM.'_theme_options_js', get_template_directory_uri() . '/inc/theme-options/theme-options.js', array('jquery', 'wp-color-picker') ); wp_enqueue_style( TXTDOM.'_theme_options_css', get_template_directory_uri() . '/inc/theme-options/theme-options.css', array('wp-color-picker') ); } // enqueue_scripts function edit_capability () { return 'edit_theme_options'; } // edit_capability function default_theme_options () { return array( 'copyrightArea' => '

Amministrazione Accessibile – Sviluppato da Spazio Sputnik – Basato su Bootstrap 3

', 'col1' => '#428BCA', 'bio' => '', 'albo' => 1, 'avcp' => 1 ); } // default_theme_options function get_theme_options () { return get_option( TXTDOM.'_theme_options', $this->default_theme_options() ); } // get_theme_options function add_page () { add_theme_page( __( 'Opzioni del Tema', 'amm-accessibile' ), // Name of page __( 'Opzioni Tema', 'amm-accessibile' ), // Label in menu 'edit_theme_options', // Capability required 'theme_options', // Menu slug, used to uniquely identify the page array(&$this, 'theme_options_render_page') // Function that renders the options page ); } // add_page function theme_options_render_page () { // if settings updated save the custom style if(isset($_GET['settings-updated']) && $_GET['settings-updated']) $this->_save(); ?>

default_theme_options(); // Simple fields $fields = array('copyrightArea', 'bio'); for($i=1; $i<5;$i++) $fields []= "col$i"; foreach($fields as $f) if ( isset( $input[$f] ) ) $output[$f] = $input[$f]; // Checkboxes $checkboxes = array('albo', 'avcp'); foreach($checkboxes as $c) if( !isset($input[$c]) ) $output[$c] = 0; // End return $this->options = $output; } // theme_options_validate function copyrightArea_field () { ?> options['bio'], 1 ); ?> /> Spunta la casella per visualizzare il blocco di informazioni biografiche dell'autore al fondo degli articoli. options['albo'], 1 ); ?> /> Spunta la casella per utilizzare la versione personalizzata del plugin "Albo Pretorio" per questo tema. options['avcp'], 1 ); ?> /> Spunta la casella per utilizzare la versione personalizzata del plugin "AVCP" per questo tema. _colorField(substr($name, strlen('color_'))); } // __call }