<?php
/**
 * Theme Customizer Controls - Blog Settings
 *
 * @package shop-zen
 */

defined( 'ABSPATH' ) || exit;


if ( ! function_exists( 'shop_zen_customizer_blog_register' ) ) :
function shop_zen_customizer_blog_register( $wp_customize ) {

	/**
	 * Blog Settings Section
	 */
	$wp_customize->add_section(
		'shop_zen_blog_settings',
		array(
			'priority'   => 22,
			'capability' => 'edit_theme_options',
			'title'      => esc_html__( 'Blog Settings', 'shop-zen' ),
		)
	);

	// Title label - Blog Page Header
	$wp_customize->add_setting(
		'shop_zen_blog_header_label',
		array(
			'sanitize_callback' => 'shop_zen_sanitize_title',
		)
	);

	$wp_customize->add_control(
		new Shop_Zen_Title_Info_Control( $wp_customize, 'shop_zen_blog_header_label',
		array(
			'label'    => esc_html__( 'Blog Page Header', 'shop-zen' ),
			'section'  => 'shop_zen_blog_settings',
			'type'     => 'shop-zen-title',
			'settings' => 'shop_zen_blog_header_label',
		)
	));

	// Blog page pill text
	$wp_customize->add_setting(
		'shop_zen_blog_pill_text',
		array(
			'default'           => __( 'Our Journal', 'shop-zen' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'shop_zen_sanitize_text_field',
			'transport'         => 'refresh',
		)
	);

	$wp_customize->add_control(
		'shop_zen_blog_pill_text',
		array(
			'settings'    => 'shop_zen_blog_pill_text',
			'section'     => 'shop_zen_blog_settings',
			'type'        => 'text',
			'label'       => esc_html__( 'Blog Page Pill Text', 'shop-zen' ),
			'description' => esc_html__( 'Small pill label displayed above the heading on the blog listing page.', 'shop-zen' ),
		)
	);

	// Blog page heading text
	$wp_customize->add_setting(
		'shop_zen_blog_heading',
		array(
			'default'           => __( 'Blog', 'shop-zen' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'shop_zen_sanitize_text_field',
			'transport'         => 'refresh',
		)
	);

	$wp_customize->add_control(
		'shop_zen_blog_heading',
		array(
			'settings'    => 'shop_zen_blog_heading',
			'section'     => 'shop_zen_blog_settings',
			'type'        => 'text',
			'label'       => esc_html__( 'Blog Page Heading', 'shop-zen' ),
			'description' => esc_html__( 'Heading text displayed on the blog listing page.', 'shop-zen' ),
		)
	);

	// Blog page subheading text
	$wp_customize->add_setting(
		'shop_zen_blog_subheading',
		array(
			'default'           => esc_html__( 'Stories on design, craftsmanship, and the art of intentional living.', 'shop-zen' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'shop_zen_sanitize_textarea_field',
			'transport'         => 'refresh',
		)
	);

	$wp_customize->add_control(
		'shop_zen_blog_subheading',
		array(
			'settings'    => 'shop_zen_blog_subheading',
			'section'     => 'shop_zen_blog_settings',
			'type'        => 'textarea',
			'label'       => esc_html__( 'Blog Page Subheading', 'shop-zen' ),
			'description' => esc_html__( 'Subheading text displayed below the heading on the blog listing page.', 'shop-zen' ),
		)
	);
}
endif;

add_action( 'customize_register', 'shop_zen_customizer_blog_register' );
