__('Navigation', 'abedul'), 'pagination' => __('Pagination', 'abedul'), ); /** * Removes the control for displaying or not the header text and adds the posibility of displaying the site title and tagline separately. */ //=============================== $wp_customize->remove_control('display_header_text'); //=============================== $wp_customize->add_setting('abedul_theme_options[show_site_title]', array( 'default' => 1, 'sanitize_callback' => 'absint', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control( 'show_site_title', array( 'label' => __('Display Site Title', 'abedul'), 'section' => 'title_tagline', 'settings' => 'abedul_theme_options[show_site_title]', 'type' => 'checkbox', )); //=============================== $wp_customize->add_setting( 'abedul_theme_options[show_site_description]', array( 'default' => 1, 'sanitize_callback' => 'absint', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control('show_site_description', array( 'label' => __('Display Tagline', 'abedul'), 'section' => 'title_tagline', 'settings' => 'abedul_theme_options[show_site_description]', 'type' => 'checkbox', )); /** * Adds the possibility of choosing between navigation or pagination in multiple view pages. */ //=============================== $wp_customize->add_section( 'Blog Navigation', array( 'title' => __( 'Navigation Settings', 'abedul' ), ) ); //=============================== $wp_customize->add_setting('abedul_theme_options[blog_navigation]', array( 'sanitize_callback' => 'abedul_sanitize_blog_nav', 'capability' => 'edit_theme_options', 'type' => 'option', 'default' => 'navigation', )); $wp_customize->add_control( 'blog_navigation', array( 'settings' => 'abedul_theme_options[blog_navigation]', 'label' => __('Choose your preferred mode of navigating between old and new articles','abedul'), 'section' => 'Blog Navigation', 'type' => 'radio', 'choices' => $blog_navigation_array, )); } add_action( 'customize_register', 'abedul_customize_register' ); /** * Sanitization for navigation choice */ function abedul_sanitize_blog_nav( $value ) { $recognized = abedul_blog_nav(); if ( array_key_exists( $value, $recognized ) ) { return $value; } return apply_filters( 'abedul_blog_nav', current( $recognized ) ); } function abedul_blog_nav() { $default = array( 'navigation' => 'navigation', 'pagination' => 'pagination', ); return apply_filters( 'abedul_blog_nav', $default ); } function abedul_get_option_defaults() { $defaults = array( 'show_site_title' => 1, 'show_site_description' => 1, 'blog_navigation' => 'navigation', ); return apply_filters( 'abedul_get_option_defaults', $defaults ); } function abedul_get_options() { // Options API return wp_parse_args( get_option( 'abedul_theme_options', array() ), abedul_get_option_defaults() ); }