add_section( 'ananya_blog_page_options_section', array(
'title' => __( 'Blog Page Settings', 'ananya' ),
'priority' => 1,
'capability' => 'edit_theme_options',
'panel' => 'ananya_options_panel',
) );
// =======================================================================
// = Post content display option: Post Excerpt/Full Post =
// =======================================================================
$wp_customize->add_setting( 'ananya_post_display_type_option', array(
'default' => 'post-excerpt',
'sanitize_callback' => 'ananya_sanitize_post_display_option',
'transport' => 'refresh',
));
$wp_customize->add_control( 'ananya_post_display_type_option',
array(
'label' => __( 'How would you like to dispaly post content on Blog posts index page?', 'ananya' ),
'section' => 'ananya_blog_page_options_section',
'settings' => 'ananya_post_display_type_option',
'type' => 'radio',
'choices' => array(
'post-excerpt' => __( 'Post Excerpt', 'ananya' ),
'full-post' => __( 'Full Post', 'ananya' ),
),
));
// =======================================================================
// = Disable/Hide footer on blog page =
// =======================================================================
$wp_customize->add_setting( 'ananya_hide_blog_page_post_footer_option', array(
'default' => false,
'sanitize_callback' => 'ananya_sanitize_checkbox',
'transport' => 'refresh',
));
$wp_customize->add_control( 'ananya_hide_blog_page_post_footer_option',
array(
'label' => __( 'Hide footer of a post on Blog posts index page.', 'ananya' ),
'description' => __( 'If you select this option the blog post footer which has post\'s Category and Social Media Sharing buttons will be removed.', 'ananya'),
'section' => 'ananya_blog_page_options_section',
'settings' => 'ananya_hide_blog_page_post_footer_option',
'type' => 'checkbox',
));
}
add_action( 'customize_register', 'ananya_custom_theme_options_section_setup' );
if ( ! function_exists( 'ananya_sanitize_post_display_option' ) ) :
/**
* Sanitization callback for post display option.
*
*
* @param string $value post display style.
* @return string $value post display style.
* @since 1.0
*/
function ananya_sanitize_post_display_option( $value ) {
if ( ! in_array( $value, array( 'post-excerpt', 'full-post' ) ) ) {
$value = 'post-excerpt';
}
return $value;
}
endif; // ananya_sanitize_post_display_option