add_panel( 'agama_blue_panel', array( 'title' => __( 'Agama Blue Options', 'agama-blue' ), 'description' => __( 'Agama blue theme options.', 'agama-blue' ), 'capability' => 'edit_theme_options', 'priority' => 120 ) ); // Blog Section $wp_customize->add_section( 'agama_blue_blog_section', array( 'title' => __( 'Blog', 'agama-blue' ), 'description' => __( 'Blog settings.', 'agama-blue' ), 'panel' => 'agama_blue_panel' ) ); // Agama Blue blog feature $wp_customize->add_setting( 'agama_blue_blog', array( 'default' => true, 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'agama_blue_sanitize_checkbox' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'agama_blue_blog', array( 'label' => __( 'Enable blog feature ?', 'agama-blue' ), 'description' => __( 'Enable blog feature on homepage.', 'agama-blue' ), 'section' => 'agama_blue_blog_section', 'settings' => 'agama_blue_blog', 'type' => 'checkbox' ) ) ); // Blog Heading $wp_customize->add_setting( 'agama_blue_blog_heading', array( 'default' => 'Latest from the Blog', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'agama_blue_blog_heading', array( 'label' => __( 'Blog Heading', 'agama-blue' ), 'description' => __( 'Set custom blog section heading title.', 'agama-blue' ), 'section' => 'agama_blue_blog_section', 'settings' => 'agama_blue_blog_heading', 'type' => 'text' ) ) ); // Blog Posts Heading $wp_customize->add_setting( 'agama_blue_blog_posts_number', array( 'default' => '4', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'agama_blue_blog_posts_number', array( 'label' => __( 'Blog Posts', 'agama-blue' ), 'description' => __( 'Enter how many blog posts should appear on blog section on homepage.', 'agama-blue' ), 'section' => 'agama_blue_blog_section', 'settings' => 'agama_blue_blog_posts_number', 'type' => 'text' ) ) ); } add_action( 'customize_register', 'agama_blue_customize_register' ); /** * Checkbox sanitization callback. * * Sanitization callback for 'checkbox' type controls. This callback sanitizes `$checked` * as a boolean value, either TRUE or FALSE. * * @param bool $checked Whether the checkbox is checked. * @return bool Whether the checkbox is checked. */ function agama_blue_sanitize_checkbox( $checked ) { // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } /** * Generating Dynamic CSS * * @since 1.0.1 */ function agama_blue_customize_css() { ?>