'', 'disabled' => '', ); /* * Display for options and meta */ public function display() { $this->echoOptionHeader(); if ( empty( $this->settings['enabled'] ) ) { $this->settings['enabled'] = __( 'Enabled', TF_I18NDOMAIN ); } if ( empty( $this->settings['disabled'] ) ) { $this->settings['disabled'] = __( 'Disabled', TF_I18NDOMAIN ); } ?> getValue(), 1 ) ?>> echoOptionFooter(); self::$firstLoad = false; } public function cleanValueForSaving( $value ) { return $value != '1' ? '0' : '1'; } public function cleanValueForGetting( $value ) { return $value == '1' ? true : false; } /* * Display for theme customizer */ public function registerCustomizerControl( $wp_customize, $section, $priority = 1 ) { $wp_customize->add_control( new TitanFrameworkOptionEnableControl( $wp_customize, $this->getID(), array( 'label' => $this->settings['name'], 'section' => $section->settings['id'], 'settings' => $this->getID(), 'description' => $this->settings['desc'], 'priority' => $priority, 'options' => $this->settings, ) ) ); } } /* * We create a new control for the theme customizer */ add_action( 'customize_register', 'registerTitanFrameworkOptionEnableControl', 1 ); function registerTitanFrameworkOptionEnableControl() { class TitanFrameworkOptionEnableControl extends WP_Customize_Control { public $description; public $options; private static $firstLoad = true; public function render_content() { if ( empty( $this->options['enabled'] ) ) { $this->options['enabled'] = __( 'Enabled', TF_I18NDOMAIN ); } if ( empty( $this->options['disabled'] ) ) { $this->options['disabled'] = __( 'Disabled', TF_I18NDOMAIN ); } ?>