taxonomy = $our_taxonomy; parent::__construct( $manager, $id, $args ); } /** * Render content. * * @since 1.0.0 */ public function render_content() { $tax_args = array( 'hierarchical' => 0, 'taxonomy' => $this->taxonomy, ); $all_taxonomies = get_categories( $tax_args ); ?> ID] = $posts->post_title; } // Function For enable/disable Section if ( !function_exists('section_option') ) : function section_option () { $section_option = array( 'on' => esc_html__('ON', 'airnews'), 'off' => esc_html__('OFF', 'airnews') ); return apply_filters('section_option', $section_option); } endif; // Extra Function For Layout if (!function_exists('col_layout_option')) : function col_layout_option() { $col_layout_option = array( '6' => esc_html__('2 Column Layout', 'airnews'), '4' => esc_html__('3 Column Layout', 'airnews'), ); return apply_filters('col_layout_option', $col_layout_option); } endif; /* Sanitization */ if ( !function_exists('sanitize_select') ) : function sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_text_field( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } endif; function sanitize_dropdown_pages( $page_id, $setting ) { // Ensure $input is an absolute integer. $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } /** Front Page Setting **/ $wp_customize->add_panel('frontpage', array('title' => esc_html__('airnews Sections Setting', 'airnews'), 'description' => '', 'priority' => 1,) ); // Add Header Bar Section /** Start Header Search **/ $wp_customize->add_section('header_bar_search', array( 'title' => esc_html__('Menu Bar Search', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 99 )); $wp_customize->add_setting( 'header_search_button_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_header_onoff = section_option(); $wp_customize->add_control( 'header_search_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Menu Bar Search', 'airnews'), 'section' => 'header_bar_search', 'choices' => $airnews_header_onoff, 'priority' => 1 ) ); /** Start Header Social Bar **/ $wp_customize->add_section('header_bar_social_links', array( 'title' => esc_html__('Menu Bar Social Links', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 100 )); $wp_customize->add_setting( 'header_button_social_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_header_onoff = section_option(); $wp_customize->add_control( 'header_button_social_onoff', array( 'type' => 'radio', 'label' => esc_html__('Menu Bar Social', 'airnews'), 'section' => 'header_bar_social_links', 'choices' => $airnews_header_onoff, 'priority' => 1 ) ); $airnews_header_bar_social_link_no = 4; for( $i = 1; $i <= $airnews_header_bar_social_link_no; $i++ ) { $airnews_header_bar_social_link = 'header_bar_social_link_' . $i; $airnews_label = esc_html__( 'Social Media URL ', 'airnews' ) . $i; $wp_customize->add_setting( $airnews_header_bar_social_link, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( $airnews_header_bar_social_link, array( 'label' => $airnews_label, 'section' => 'header_bar_social_links', 'type' => 'text', 'priority' => 110 + $i )); } // Add News Section /** Start Menu news button **/ $wp_customize->add_section('news', array( 'title' => esc_html__('News Ticker Section', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 110 )); $wp_customize->add_setting( 'news_button_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_news_onoff = section_option(); $wp_customize->add_control( 'news_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('News Ticker Section', 'airnews'), 'section' => 'news', 'choices' => $airnews_news_onoff, 'priority' => 1 ) ); // News Title $wp_customize->add_setting('news_title', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('news_title', array( 'label' => esc_html__('Title', 'airnews'), 'section' => 'news', 'priority' => 2 )); $wp_customize->add_setting( 'news_category',array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new Dropdown_Taxonomies_Control( $wp_customize, 'news_category', array( 'label' => esc_html__('Category For News', 'airnews'), 'section' => 'news', 'type' => 'dropdown-taxonomies', 'taxonomy' => 'category', 'priority' => 3, ) ) ); // No of News $wp_customize->add_setting( 'no_of_news', array( 'default' => '', 'sanitize_callback' => 'absint', )); $wp_customize->add_control( 'no_of_news', array( 'label' => esc_html__( 'No Of News ', 'airnews' ), 'section' => 'news', 'type' => 'text', 'priority' => 4 )); /** Start Header Bar Links **/ $wp_customize->add_section('header_bar_links', array( 'title' => esc_html__('Header Info', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 120 )); $wp_customize->add_setting( 'header_button_links_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_header_onoff = section_option(); $wp_customize->add_control( 'header_button_links_onoff', array( 'type' => 'radio', 'label' => esc_html__('Header Info', 'airnews'), 'section' => 'header_bar_links', 'choices' => $airnews_header_onoff, 'priority' => 1 ) ); $airnews_label_array1 = array( '', 'Call Us Label Text', 'Email Label Text', 'Visit Us Label Text' ); $airnews_label_array2 = array( '', 'Call Us value', 'Email value', 'Visit Us value' ); $airnews_header_bar_link_no = 3; for( $i = 1; $i <= $airnews_header_bar_link_no; $i++ ) { $airnews_header_bar_link_text1 = 'header_bar_link_text1_' . $i ; $airnews_label_text1 = $airnews_label_array1[$i]; $airnews_header_bar_link_text2 = 'header_bar_link_text2_' . $i ; $airnews_label_text2 = $airnews_label_array2[$i]; $wp_customize->add_setting( $airnews_header_bar_link_text1, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( $airnews_header_bar_link_text1, array( 'label' => $airnews_label_text1, 'section' => 'header_bar_links', 'type' => 'text', 'priority' => 110 + $i )); $wp_customize->add_setting( $airnews_header_bar_link_text2, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( $airnews_header_bar_link_text2, array( 'label' => $airnews_label_text2, 'section' => 'header_bar_links', 'type' => 'text', 'priority' => 110 + $i )); } // Add Slider Section /** Start Slider Section **/ $wp_customize->add_section('slider', array( 'title' => esc_html__('Featured Section', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 120 )); $wp_customize->add_setting( 'slider_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_slider_onoff = section_option(); $wp_customize->add_control( 'slider_onoff', array( 'type' => 'radio', 'label' => esc_html__('Featured Section', 'airnews'), 'section' => 'slider', 'choices' => $airnews_slider_onoff, 'priority' => 1 ) ); $airnews_slide_category = 'slide_category'; $airnews_slide_posts = 'slide_posts'; $airnews_slide_category_label = esc_html__( 'Select Category For Featured Section', 'airnews'); $airnews_slide_posts_label = esc_html__( 'Number of Posts for Featured Section', 'airnews'); // Slider Image $wp_customize->add_setting( $airnews_slide_category, array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new Dropdown_Taxonomies_Control( $wp_customize, $airnews_slide_category, array( 'label' => $airnews_slide_category_label, 'section' => 'slider', 'type' => 'dropdown-taxonomies', 'taxonomy' => 'category', 'priority' => 2, ) ) ); $wp_customize->add_setting( $airnews_slide_posts, array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( $airnews_slide_posts, array( 'label' => $airnews_slide_posts_label, 'section' => 'slider', 'type' => 'text', 'priority' => 3, )); // Add Featured Post Section /** Start Featured Section **/ $wp_customize->add_section('featured_post_section', array( 'title' => esc_html__('Featured Post Section', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 140 )); $wp_customize->add_setting( 'featured_post_button_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_featured_post_onoff = section_option(); $wp_customize->add_control( 'featured_post_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Featured Post Section', 'airnews'), 'section' => 'featured_post_section', 'choices' => $airnews_featured_post_onoff, 'priority' => 2 ) ); /** Top News */ $wp_customize->add_setting( 'featured_post', array( 'default' => '', 'sanitize_callback' => 'sanitize_select', ) ); $wp_customize->add_control( 'featured_post', array( 'label' => __( 'Select Post for Featured Post Section', 'airnews' ), 'section' => 'featured_post_section', 'type' => 'select', 'choices' => $options_posts, ) ); // Add Footer Section /** Start Footer Section **/ $wp_customize->add_section('footer', array( 'title' => esc_html__('Footer Section', 'airnews'), 'description' => '', 'panel' => 'frontpage', 'priority' => 170 )); $wp_customize->add_setting( 'footer_button_onoff', array( 'default' => 'off', 'sanitize_callback' => 'sanitize_select', ) ); $airnews_footer_onoff = section_option(); $wp_customize->add_control( 'footer_button_onoff', array( 'type' => 'radio', 'label' => esc_html__('Footer Section', 'airnews'), 'section' => 'footer', 'choices' => $airnews_footer_onoff, 'priority' => 2 ) ); // Footer Copyright $wp_customize->add_setting('footer_copyright', array( 'default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('footer_copyright', array( 'label' => esc_html__('Copyright', 'airnews'), 'section' => 'footer', 'type' => 'text', 'priority' => 3 )); } endif; add_action( 'customize_register', 'airnews_customizer_register' );