<?php
/**
* Posts Summaries options
*
* @package GridRead WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

function gridread_posts_summaries_options($wp_customize) {

    $wp_customize->add_section( 'gridread_section_posts_summaries', array( 'title' => esc_html__( 'Posts Summaries Options', 'gridread' ), 'description' => esc_html__('To display your latest posts as a grid on your homepage, please set the "Your homepage displays" option to "Your latest posts." You can find this setting in your WordPress Dashboard by navigating to "Settings" -> "Reading" -> "Your homepage displays."', 'gridread'), 'panel' => 'gridread_main_options_panel', 'priority' => 160 ) );

    $wp_customize->add_setting( 'gridread_options[hide_posts_heading]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_hide_posts_heading_control', array( 'label' => esc_html__( 'Hide HomePage Posts Heading', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[hide_posts_heading]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[posts_heading]', array( 'default' => esc_html__( 'Recent Posts', 'gridread' ), 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) );

    $wp_customize->add_control( 'gridread_posts_heading_control', array( 'label' => esc_html__( 'HomePage Posts Heading', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[posts_heading]', 'type' => 'text', ) );

    $wp_customize->add_setting( 'posts_per_page', array( 'default' => get_option('posts_per_page'), 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_positive_integer' ) );

    $wp_customize->add_control( 'gridread_posts_per_page_control', array( 'label' => esc_html__( 'Number of Posts per Page', 'gridread' ), 'description' => esc_html__('Set the maximum number of posts displayed on each blog page.', 'gridread'), 'section' => 'gridread_section_posts_summaries', 'settings' => 'posts_per_page', 'type' => 'text' ) );

    $wp_customize->add_setting( 'gridread_options[post_summaries_style]', array( 'default' => 'grid', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_post_summaries_style' ) );

    $wp_customize->add_control( 'gridread_post_summaries_style_control', array( 'label' => esc_html__( 'Post Summaries Style', 'gridread' ), 'description' => esc_html__('Select the post summaries style for non-singular pages.', 'gridread'), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[post_summaries_style]', 'type' => 'select', 'choices' => array( 'grid' => esc_html__('Grid Posts', 'gridread'), 'non-grid' => esc_html__('Non-Grid Posts', 'gridread') ) ) );

    $wp_customize->add_setting( 'gridread_options[hide_thumbnail_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_hide_thumbnail_home_control', array( 'label' => esc_html__( 'Hide Featured Images from Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[hide_thumbnail_home]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[featured_nongrid_media_under_post_title]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_featured_nongrid_media_under_post_title_control', array( 'label' => esc_html__( 'Move Featured Images to the Bottom of Post Titles on Non-Grid Post Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[featured_nongrid_media_under_post_title]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[remove_thumbnail_home_link]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_remove_thumbnail_home_link_control', array( 'label' => esc_html__( 'Remove Links from Grid | Non-Grid Post Featured Images', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[remove_thumbnail_home_link]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[hide_thumbnail_home_data]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_hide_thumbnail_home_data_control', array( 'label' => esc_html__( 'Hide Post Thumbnail Overlay Data (Post Title, Post Categories, Post Meta) from Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[hide_thumbnail_home_data]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[hide_post_title_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_hide_post_title_home_control', array( 'label' => esc_html__( 'Hide Post Titles from Grid | Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[hide_post_title_home]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[remove_post_title_home_link]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_remove_post_title_home_link_control', array( 'label' => esc_html__( 'Remove Links from Grid | Non-Grid Post Titles', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[remove_post_title_home_link]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[show_post_categories_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_show_post_categories_home_control', array( 'label' => esc_html__( 'Show Post Categories on Grid | Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[show_post_categories_home]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[hide_posted_date_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_hide_posted_date_home_control', array( 'label' => esc_html__( 'Hide Posted Dates from Grid | Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[hide_posted_date_home]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[show_post_author_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_show_post_author_home_control', array( 'label' => esc_html__( 'Show Post Author Names on Grid | Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[show_post_author_home]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'gridread_options[show_comments_link_home]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gridread_sanitize_checkbox', ) );

    $wp_customize->add_control( 'gridread_show_comments_link_home_control', array( 'label' => esc_html__( 'Show Comment Links on Grid | Non-Grid Posts Summaries', 'gridread' ), 'section' => 'gridread_section_posts_summaries', 'settings' => 'gridread_options[show_comments_link_home]', 'type' => 'checkbox', ) );

}