/** * Add some stuff to the Theme Options Panel * * @param $sections */ public function register_global_setting($sections) { // Get post types with support for our feature $post_types = array(); foreach (get_post_types() as $post_type) { if (post_type_supports($post_type, $this->global_feature)) { $post_types[] = $post_type; } } foreach ($post_types as $post_type) { $id = 'post_type_' . $post_type . '_single_template'; $section_id = G1_Single_Settings_Feature()->get_section_id($post_type); $templates = $this->get_template_manager()->get_templates_choices(array('post_type' => $post_type)); $options = array(); foreach ($templates as $template_id => $template_path) { $options[$template_id] = array('title' => $template_id, 'img' => $template_path); } $std = ''; if (!empty($options)) { $std = array_keys($options); $std = $std[0]; } if (!empty($sections[$section_id])) { $sections[$section_id]['fields'][] = array('id' => $id, 'priority' => 190, 'type' => 'radio_img', 'title' => __('Template', Redux_TEXT_DOMAIN), 'sub_desc' => '<p>' . __('Color Legend:', Redux_TEXT_DOMAIN) . '</p>' . '<ul>' . '<li>' . __('dark gray: media', Redux_TEXT_DOMAIN) . '</li>' . '<li>' . __('light gray: text', Redux_TEXT_DOMAIN) . '</li>' . '<li>' . __('blue: sidebar', Redux_TEXT_DOMAIN) . '</li>' . '<ul>', 'options' => $options, 'std' => $std); } } return $sections; }
/** * Registers single elements for post types * * @param $sections */ public function register_post_type_single_element($sections) { foreach ($this->get_post_types() as $post_type) { $id = $this->get_global_setting_id($post_type); $section_id = G1_Single_Settings_Feature()->get_section_id($post_type); if (!empty($sections[$section_id])) { $sections[$section_id]['fields'][] = array('id' => $id, 'priority' => $this->get_priority(), 'type' => 'select', 'title' => $this->get_label(), 'sub_desc' => $this->get_help(), 'options' => $this->get_choices()); } } return $sections; }