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

defined( 'ABSPATH' ) || exit;


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

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

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

	$wp_customize->add_control(
		new Pawwell_Title_Info_Control( $wp_customize, 'pawwell_blog_header_label',
		array(
			'label'    => esc_html__( 'Blog Page Header', 'pawwell' ),
			'section'  => 'pawwell_blog_settings',
			'type'     => 'pawwell-title',
			'settings' => 'pawwell_blog_header_label',
		)
	));

	// Blog page eyebrow text
	$wp_customize->add_setting(
		'pawwell_blog_eyebrow',
		array(
			'default'           => __( 'The PawCare Journal', 'pawwell' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'pawwell_sanitize_text_field',
			'transport'         => 'refresh',
		)
	);

	$wp_customize->add_control(
		'pawwell_blog_eyebrow',
		array(
			'settings'    => 'pawwell_blog_eyebrow',
			'section'     => 'pawwell_blog_settings',
			'type'        => 'text',
			'label'       => esc_html__( 'Blog Page Eyebrow', 'pawwell' ),
			'description' => esc_html__( 'Small label displayed above the heading on the blog listing page.', 'pawwell' ),
		)
	);

	// Blog page heading text
	$wp_customize->add_setting(
		'pawwell_blog_heading',
		array(
			'default'           => __( 'Blog', 'pawwell' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'pawwell_sanitize_text_field',
			'transport'         => 'refresh',
		)
	);

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

	// Blog page subheading text
	$wp_customize->add_setting(
		'pawwell_blog_subheading',
		array(
			'default'           => __( 'Expert-written guides on nutrition, training, health, and the everyday joys of life with pets.', 'pawwell' ),
			'type'              => 'theme_mod',
			'sanitize_callback' => 'pawwell_sanitize_textarea_field',
			'transport'         => 'refresh',
		)
	);

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

add_action( 'customize_register', 'pawwell_customizer_blog_register' );
