/** * 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 Section to Customizer * @param [type] $wp_customize [description] * @param [type] $section_details [description] */ public function add_section($wp_customize, $section_details) { $this->fields = $section_details['fields']; unset($section_details['fields']); extract($section_details); $wp_customize->add_section($this->_section_id, array('priority' => isset($priority) ? $priority : '', 'title' => isset($title) ? $title : '', 'description' => isset($description) ? $description : '', 'panel' => $this->_panel_id, 'capability' => 'edit_theme_options')); $this->add_settings($wp_customize); }