Last active
March 27, 2017 18:35
-
-
Save Tmeister/a581d045f0e880f450bb13999abd780b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function _register_controls() { | |
/** | |
* Start a control section. | |
*/ | |
$this->start_controls_section( | |
'section-ine-tabs', | |
[ 'label' => __( 'INE Tabs', 'sage' ), ] | |
); | |
/** | |
* Repeater Controls | |
*/ | |
$repeater = new Repeater(); | |
$repeater->start_controls_tabs( 'ine_tabs_repeater' ); | |
$repeater->start_controls_tab( 'tab', [ 'label' => __( 'Tab', 'sage' ) ] ); | |
$repeater->add_control( | |
'title', | |
[ | |
'label' => __( 'Tab Title', 'sage' ), | |
'type' => Controls_Manager::TEXT | |
] | |
); | |
$repeater->end_controls_tab(); | |
$repeater->end_controls_tabs(); | |
/** | |
* Once the repeater controls are done | |
* We need to ADD THE REPEATER as a Control | |
*/ | |
$this->add_control( | |
'tabs', | |
[ | |
'label' => __( 'Tabs', 'sage' ), | |
'type' => Controls_Manager::REPEATER, | |
'show_label' => true, | |
'default' => [ | |
[ | |
'title' => __( 'Default Tab', 'sage' ), | |
] | |
], | |
'fields' => array_values( $repeater->get_controls() ), | |
'title_field' => '{{{title}}}', | |
] | |
); | |
$this->end_controls_section(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function _register_controls() { | |
$this->start_controls_section( | |
'section-ine-tabs', | |
[ 'label' => __( 'INE Tabs', 'sage' ), ] | |
); | |
$repeater = new Repeater(); | |
$repeater->start_controls_tabs( 'ine_tabs_repeater' ); | |
$repeater->start_controls_tab( 'tab', [ 'label' => __( 'Tab', 'sage' ) ] ); | |
$repeater->add_control( | |
'tab_title', | |
[ | |
'label' => __( 'Tab Title', 'sage' ), | |
'type' => Controls_Manager::TEXT | |
] | |
); | |
$repeater->end_controls_tab(); | |
$repeater->end_controls_tabs(); | |
$this->end_controls_section(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment