/** * Maera Restaurant Kirki panels and sections. * @since 1.0.0 * @param [type] $wp_customize [description] * @return [type] [description] */ function maera_res_customizer_sections($wp_customize) { $panels = array('maera_res_sections' => array('title' => __('Sections', 'maera-restaurant'), 'description' => __('Set an array of background options.', 'maera-restaurant'), 'priority' => 45)); $sections = array('maera_res_restaurant' => array('title' => __('Restaurant', 'maera-restaurant'), 'priority' => 25, 'panel' => null), 'maera_res_layout' => array('title' => __('Layout', 'maera-restaurant'), 'priority' => 30, 'panel' => null), 'maera_res_colors' => array('title' => __('Colors', 'maera-restaurant'), 'priority' => 35, 'panel' => null), 'maera_res_typography' => array('title' => __('Typography', 'maera-restaurant'), 'priority' => 40, 'panel' => null), 'maera_res_section_1' => array('title' => __('First Section', 'maera-restaurant'), 'priority' => 50, 'panel' => 'maera_res_sections'), 'maera_res_section_2' => array('title' => __('Second Section', 'maera-restaurant'), 'priority' => 55, 'panel' => 'maera_res_sections'), 'maera_res_section_3' => array('title' => __('Third Section', 'maera-restaurant'), 'priority' => 60, 'panel' => 'maera_res_sections'), 'maera_res_section_4' => array('title' => __('Fourth Section', 'maera-restaurant'), 'priority' => 65, 'panel' => 'maera_res_sections'), 'maera_res_section_5' => array('title' => __('Fifth Section', 'maera-restaurant'), 'priority' => 70, 'panel' => 'maera_res_sections'), 'maera_res_body' => array('title' => __('Content Areas', 'maera-restaurant'), 'priority' => 75, 'panel' => 'maera_res_sections'), 'maera_res_footer' => array('title' => __('Footer', 'maera-restaurant'), 'priority' => 80, 'panel' => 'maera_res_sections'), 'maera_res_social' => array('title' => __('Social', 'maera-restaurant'), 'priority' => 85, 'panel' => null)); // Loop through panels and add them to Kirki. foreach ($panels as $panel => $args) { $wp_customize->add_panel($panel, array('priority' => $args['priority'], 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => $args['title'], 'description' => $args['description'])); } // Loop through sections and add them to panels/Kirki. foreach ($sections as $section => $args) { $wp_customize->add_section($section, array('title' => $args['title'], 'priority' => $args['priority'], 'panel' => $args['panel'])); } }
/** * Add Panels to Customizer options * @param [type] $wp_customize [description] * @param [type] $panel_id [description] * @param [type] $panel_details [description] */ public function add_panel($wp_customize, $panel_id, $panel_details) { $this->sections = $panel_details['sections']; unset($panel_details['sections']); extract($panel_details); $this->_panel_id = $panel_id; $wp_customize->add_panel($panel_id, array('priority' => isset($priority) ? $priority : '', 'capability' => isset($capability) ? $capability : 'edit_theme_options', 'title' => isset($title) ? $title : '', 'description' => isset($description) ? $description : '')); $this->add_sections($wp_customize); }