<?php 


// Add Blog Section to Customizer
function howcan_customize_blog_section( $wp_customize ) {





    // Section blog  text 
    $wp_customize->add_section( 'howcan_blog_section', array(
        'title' => __( 'Front Blog Section', 'howcan' ),
        'priority' => 60,
        'panel' => 'howcan_theme_options_panel', // optional
    ));


   

    // Show/Hide 
    $wp_customize->add_setting('howcan_blog_on', array(
        'default'           => false,
        'sanitize_callback' => 'wp_validate_boolean',
    ));
    $wp_customize->add_control('howcan_blog_on', array(
        'label'    => __('Enable blog  Section ', 'howcan'),
        'section'  => 'howcan_blog_section',
        'type'     => 'checkbox',
    ));
    
    
    
    

    // Title Setting
    $wp_customize->add_setting( 'howcan_blog_title', array(
        'default' => __( 'Latest Blog & Resources', 'howcan' ),
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control( 'howcan_blog_title', array(
        'label' => __( 'Section Title', 'howcan' ),
        'section' => 'howcan_blog_section',
        'type' => 'text',
    ));

    // Subtitle Setting
    $wp_customize->add_setting( 'howcan_blog_subtitle', array(
        'default' => __( 'Read our latest tips, guides and resources to grow your knowledge.', 'howcan' ),
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control( 'howcan_blog_subtitle', array(
        'label' => __( 'Section Subtitle', 'howcan' ),
        'section' => 'howcan_blog_section',
        'type' => 'text',
    ));

    // Number of posts
    $wp_customize->add_setting( 'howcan_blog_count', array(
        'default' => 3,
        'sanitize_callback' => 'absint',
    ));
    $wp_customize->add_control( 'howcan_blog_count', array(
        'label' => __( 'Number of Posts', 'howcan' ),
        'section' => 'howcan_blog_section',
        'type' => 'number',
    ));
}
add_action( 'customize_register', 'howcan_customize_blog_section' );
