add_section(
'buzzhub_archive_settings',
array(
'title' => esc_html__( 'Archive/Blog', 'buzzhub' ),
'description' => esc_html__( 'Settings for archive pages including blog page too.', 'buzzhub' ),
'panel' => 'buzzhub_general_panel',
)
);
// Archive excerpt length setting
$wp_customize->add_setting(
'buzzhub_archive_excerpt_length',
array(
'sanitize_callback' => 'buzzhub_sanitize_number_range',
'default' => 20,
)
);
$wp_customize->add_control(
'buzzhub_archive_excerpt_length',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Excerpt more length:', 'buzzhub' ),
'type' => 'number',
'input_attrs' => array( 'min' => 5 ),
)
);
// Date enable setting
$wp_customize->add_setting(
'buzzhub_enable_archive_date',
array(
'sanitize_callback' => 'buzzhub_sanitize_checkbox',
'default' => true,
)
);
$wp_customize->add_control(
'buzzhub_enable_archive_date',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Enable date.', 'buzzhub' ),
'type' => 'checkbox',
)
);
// Category enable setting
$wp_customize->add_setting(
'buzzhub_enable_archive_cat',
array(
'sanitize_callback' => 'buzzhub_sanitize_checkbox',
'default' => true,
)
);
$wp_customize->add_control(
'buzzhub_enable_archive_cat',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Enable category.', 'buzzhub' ),
'type' => 'checkbox',
)
);
// blog image enable setting
$wp_customize->add_setting(
'buzzhub_enable_archive_featured_img',
array(
'sanitize_callback' => 'buzzhub_sanitize_checkbox',
'default' => true,
)
);
$wp_customize->add_control(
'buzzhub_enable_archive_featured_img',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Enable featured image.', 'buzzhub' ),
'type' => 'checkbox',
)
);
// Content type setting
$wp_customize->add_setting(
'buzzhub_enable_archive_content_type',
array(
'sanitize_callback' => 'buzzhub_sanitize_select',
'default' => 'excerpt',
)
);
$wp_customize->add_control(
'buzzhub_enable_archive_content_type',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Content type:', 'buzzhub' ),
'choices' => array(
'full-content' => esc_html__( 'Full content', 'buzzhub' ),
'excerpt' => esc_html__( 'Excerpt', 'buzzhub' ),
),
'type' => 'radio',
)
);
// Pagination type setting
$wp_customize->add_setting(
'buzzhub_archive_pagination_type',
array(
'sanitize_callback' => 'buzzhub_sanitize_select',
'default' => 'numeric',
)
);
$archive_pagination_description = '';
$archive_pagination_choices = array(
'disable' => esc_html__( '--Disable--', 'buzzhub' ),
'numeric' => esc_html__( 'Numeric', 'buzzhub' ),
'older_newer' => esc_html__( 'Older / Newer', 'buzzhub' ),
);
if ( ! class_exists( 'JetPack' ) ) {
$archive_pagination_description = sprintf( esc_html__( 'We recommend to install %1$sJetpack%2$s and enable %3$sInfinite Scroll%4$s feature for automatic loading of posts.', 'buzzhub' ), '', '', '', '' );
} else {
$archive_pagination_choices['infinite_scroll'] = esc_html__( 'Infinite Load', 'buzzhub' );
}
$wp_customize->add_control(
'buzzhub_archive_pagination_type',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Pagination type:', 'buzzhub' ),
'description' => $archive_pagination_description,
'type' => 'select',
'choices' => $archive_pagination_choices,
)
);
$wp_customize->add_setting(
'buzzhub_archive_layout',
array(
'sanitize_callback' => 'buzzhub_sanitize_select',
'default' => 'col-2',
)
);
$wp_customize->add_control(
'buzzhub_archive_layout',
array(
'section' => 'buzzhub_archive_settings',
'label' => esc_html__( 'Archive Layout', 'buzzhub' ),
'type' => 'select',
'choices' => array(
'list-layout' => esc_html__( 'List Layout', 'buzzhub' ),
'col-1' => esc_html__( 'Column One', 'buzzhub' ),
'col-2' => esc_html__( 'Column Two', 'buzzhub' ),
'col-3' => esc_html__( 'Column Three', 'buzzhub' ),
),
)
);