vk-admin
7 years ago
admin_bar.php
7 years ago
content-meta-box.php
7 years ago
customizer.php
7 years ago
disable_guide.php
7 years ago
vk-admin-config.php
7 years ago
customizer.php
95 lines
| 1 | <?php |
| 2 | /** |
| 3 | * VkExUnit customize.php |
| 4 | * |
| 5 | * @package VkExUnit |
| 6 | * @author Kurudrive<kurudrive@gmail.com> |
| 7 | * @since 28/Sep/2017 |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Add Customize Panel |
| 12 | */ |
| 13 | |
| 14 | add_action( 'after_setup_theme', 'veu_add_customize_panel' ); |
| 15 | |
| 16 | // カスタマイズパネルを出力するかどうかの判別 |
| 17 | function veu_add_customize_panel() { |
| 18 | // 基本的にはカスタマイズ画面で「ExUnit設定」パネルは表示されない |
| 19 | if ( apply_filters( 'veu_customize_panel_activation', false ) ) { |
| 20 | // 各機能からカスタマイザー機能を有効化する指定がされてたら、親パネルである「ExUnit設定」を出力する関数を実行する |
| 21 | add_action( 'customize_register', 'veu_customize_register' ); |
| 22 | // パネルを表示する = カスタマイザーが利用されるので、独自のコントロールクラスを追加 |
| 23 | add_action( 'customize_register', 'veu_customize_register_add_control', 10 ); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | |
| 28 | // 「ExUnit設定」パネルを出力する関数 |
| 29 | function veu_customize_register( $wp_customize ) { |
| 30 | /*-------------------------------------------*/ |
| 31 | /* ExUnit Panel |
| 32 | /*-------------------------------------------*/ |
| 33 | $wp_customize->add_panel( |
| 34 | 'veu_setting', array( |
| 35 | 'priority' => 1000, |
| 36 | 'capability' => 'edit_theme_options', |
| 37 | 'theme_supports' => '', |
| 38 | 'title' => veu_get_prefix_customize_panel() . ' ' . __( 'Settings', 'vk-all-in-one-expansion-unit' ), |
| 39 | ) |
| 40 | ); |
| 41 | |
| 42 | } |
| 43 | |
| 44 | /*-------------------------------------------*/ |
| 45 | /* ExUnit Original Controls |
| 46 | /*-------------------------------------------*/ |
| 47 | function veu_customize_register_add_control() { |
| 48 | |
| 49 | /* Add text control description |
| 50 | /*-------------------------------------------*/ |
| 51 | class ExUnit_Custom_Text_Control extends WP_Customize_Control { |
| 52 | public $type = 'customtext'; |
| 53 | public $description = ''; // we add this for the extra description |
| 54 | public $input_before = ''; |
| 55 | public $input_after = ''; |
| 56 | public function render_content() { |
| 57 | ?> |
| 58 | <label> |
| 59 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 60 | <?php $style = ( $this->input_before || $this->input_after ) ? ' style="width:50%"' : ''; ?> |
| 61 | <div> |
| 62 | <?php echo wp_kses_post( $this->input_before ); ?> |
| 63 | <input type="text" value="<?php echo esc_attr( $this->value() ); ?>"<?php echo $style; ?> <?php $this->link(); ?> /> |
| 64 | <?php echo wp_kses_post( $this->input_after ); ?> |
| 65 | </div> |
| 66 | <span><?php echo $this->description; ?></span> |
| 67 | </label> |
| 68 | <?php |
| 69 | } // public function render_content() { |
| 70 | } // class Custom_Text_Control extends WP_Customize_Control |
| 71 | |
| 72 | /* Add text control description |
| 73 | /*-------------------------------------------*/ |
| 74 | class ExUnit_Custom_Html extends WP_Customize_Control { |
| 75 | public $type = 'customtext'; |
| 76 | public $custom_title_sub = ''; // we add this for the extra custom_html |
| 77 | public $custom_html = ''; // we add this for the extra custom_html |
| 78 | public function render_content() { |
| 79 | if ( $this->label ) { |
| 80 | // echo '<h2 class="admin-custom-h2">' . wp_kses_post( $this->label ) . '</h2>'; |
| 81 | echo '<h2 class="admin-custom-h2">' . wp_kses_post( $this->label ) . '</h2>'; |
| 82 | } |
| 83 | if ( $this->custom_title_sub ) { |
| 84 | echo '<h3 class="admin-custom-h3">' . wp_kses_post( $this->custom_title_sub ) . '</h3>'; |
| 85 | } |
| 86 | if ( $this->custom_html ) { |
| 87 | echo '<div>' . wp_kses_post( $this->custom_html ) . '</div>'; |
| 88 | } |
| 89 | ?> |
| 90 | <?php |
| 91 | } // public function render_content() { |
| 92 | } // class VkExUnit_Custom_Html extends WP_Customize_Control |
| 93 | |
| 94 | } // function veu_customize_register_add_control(){ |
| 95 |