<?php
/**
 * Pr Agency functions and definitions
 * @package Pr Agency
 */

/* Theme Setup */
if ( ! function_exists( 'pr_agency_setup' ) ) :

function pr_agency_setup() {

	$GLOBALS['pr_agency_content_width'] = apply_filters( 'pr_agency_content_width', 640 );

	add_theme_support( 'automatic-feed-links' );
	add_theme_support( 'post-thumbnails' );
	add_theme_support( 'woocommerce' );
	add_theme_support( 'align-wide' );
	add_theme_support( 'title-tag' );
	add_theme_support( "wp-block-styles" );
	add_theme_support( 'custom-logo', array(
		'height'      => 240,
		'width'       => 240,
		'flex-height' => true,
	) );

	add_image_size( 'pr_agency_homepage_thumb', 240, 145, true );
	register_nav_menus( array(
		'pr-agency-primary' => esc_html__( 'Primary Menu', 'pr-agency' ),
	) );

	add_theme_support( 'custom-background', array(
		'default-color' => 'f1f1f1'
	) );
	
	/*
	 * Enable support for Post Formats.
	 *
	 * See: https://codex.wordpress.org/Post_Formats
	 */
	add_theme_support(
		'post-formats', array(
			'image',
			'video',
			'gallery',
			'audio',
		)	
	);

	add_theme_support( 'html5', array(
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	) );

	add_theme_support('responsive-embeds');

	add_editor_style( array( 'assets/css/editor-style.css', pr_agency_font_url() ) );

	load_theme_textdomain( 'pr-agency', get_template_directory() . '/languages' );

}
endif; // pr_agency_setup
add_action( 'after_setup_theme', 'pr_agency_setup' );

/*radio button sanitization*/
function pr_agency_sanitize_choices( $input, $setting ) {
    global $wp_customize;
    $control = $wp_customize->get_control( $setting->id );
    if ( array_key_exists( $input, $control->choices ) ) {
        return $input;
    } else {
        return $setting->default;
    }
}

function pr_agency_sanitize_checkbox( $input ) {
	return ( ( isset( $input ) && true == $input ) ? true : false );
}

function pr_agency_sanitize_float( $input ) {
	return filter_var($input, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
}

function pr_agency_sanitize_css_value( $value ) {
	return sanitize_text_field( (string) $value );
}

// Change number or products per row to 3
if (!function_exists('pr_agency_loop_columns')) {
	function pr_agency_loop_columns() {
		$columns = get_theme_mod( 'pr_agency_products_per_column', 3 );
		return $columns; // 3 products per row
	}
}
add_filter('loop_shop_columns', 'pr_agency_loop_columns');

//Change number of products that are displayed per page (shop page)
add_filter( 'loop_shop_per_page', 'pr_agency_shop_per_page', 20 );
function pr_agency_shop_per_page( $cols ) {
  	$cols = get_theme_mod( 'pr_agency_products_per_page', 9 );
	return $cols;
}

/* Theme Widgets Setup */
function pr_agency_widgets_init() {
	register_sidebar( array(
		'name'          => esc_html__( 'Blog Sidebar', 'pr-agency' ),
		'description'   => esc_html__( 'Appears on blog page sidebar', 'pr-agency' ),
		'id'            => 'pr-agency-sidebar-1',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );
	
	register_sidebar( array(
		'name'          => esc_html__( 'Posts and Pages Sidebar', 'pr-agency' ),
		'description'   => esc_html__( 'Appears on posts and pages', 'pr-agency' ),
		'id'            => 'pr-agency-sidebar-2',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Sidebar 3', 'pr-agency' ),
		'description'   => esc_html__( 'Appears on posts and pages', 'pr-agency' ),
		'id'            => 'pr-agency-sidebar-3',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Footer 1', 'pr-agency' ),
		'description'   => esc_html__( 'Appears in footer', 'pr-agency' ),
		'id'            => 'pr-agency-footer-1',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Footer 2', 'pr-agency' ),
		'description'   => esc_html__( 'Appears in footer', 'pr-agency' ),
		'id'            => 'pr-agency-footer-2',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Footer 3', 'pr-agency' ),
		'description'   => esc_html__( 'Appears in footer', 'pr-agency' ),
		'id'            => 'pr-agency-footer-3',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Footer 4', 'pr-agency' ),
		'description'   => esc_html__( 'Appears in footer', 'pr-agency' ),
		'id'            => 'pr-agency-footer-4',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget'  => '</aside>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );
}
add_action( 'widgets_init', 'pr_agency_widgets_init' );

/* Theme Font URL */
function pr_agency_font_url(){
	$font_url = '';
	$font_family = array();
	$font_family[] = 'PT Sans:300,400,600,700,800,900';
	$font_family[] = 'Roboto:400,700';
	$font_family[] = 'Roboto Condensed:400,700';
	$font_family[] = 'Open Sans:300,300i,400,400i,500,500i,600,600i,700,700i,800,800i';
	$font_family[] = 'Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
	$font_family[] = 'Overpass';
	$font_family[] = 'Montserrat:300,400,600,700,800,900';
	$font_family[] = 'Playball:300,400,600,700,800,900';
	$font_family[] = 'Alegreya:300,400,600,700,800,900';
	$font_family[] = 'Playfair Display SC:wght@400,700,900';
	$font_family[] = 'Julius Sans One';
	$font_family[] = 'Arsenal';
	$font_family[] = 'Slabo';
	$font_family[] = 'Lato';
	$font_family[] = 'Overpass Mono';
	$font_family[] = 'Source Sans Pro';
	$font_family[] = 'Raleway';
	$font_family[] = 'Merriweather';
	$font_family[] = 'Droid Sans';
	$font_family[] = 'Rubik';
	$font_family[] = 'Lora';
	$font_family[] = 'Ubuntu';
	$font_family[] = 'Cabin';
	$font_family[] = 'Arimo';
	$font_family[] = 'Playfair Display';
	$font_family[] = 'Quicksand';
	$font_family[] = 'Padauk';
	$font_family[] = 'Muli';
	$font_family[] = 'Inconsolata';
	$font_family[] = 'Bitter';
	$font_family[] = 'Pacifico';
	$font_family[] = 'Indie Flower';
	$font_family[] = 'VT323';
	$font_family[] = 'Dosis';
	$font_family[] = 'Frank Ruhl Libre';
	$font_family[] = 'Fjalla One';
	$font_family[] = 'Oxygen';
	$font_family[] = 'Arvo';
	$font_family[] = 'Noto Serif';
	$font_family[] = 'Lobster';
	$font_family[] = 'Crimson Text';
	$font_family[] = 'Yanone Kaffeesatz';
	$font_family[] = 'Anton';
	$font_family[] = 'Libre Baskerville';
	$font_family[] = 'Bree Serif';
	$font_family[] = 'Gloria Hallelujah';
	$font_family[] = 'Josefin Sans';
	$font_family[] = 'Abril Fatface';
	$font_family[] = 'Varela Round';
	$font_family[] = 'Vampiro One';
	$font_family[] = 'Shadows Into Light';
	$font_family[] = 'Cuprum';
	$font_family[] = 'Rokkitt';
	$font_family[] = 'Vollkorn';
	$font_family[] = 'Francois One';
	$font_family[] = 'Orbitron';
	$font_family[] = 'Patua One';
	$font_family[] = 'Acme';
	$font_family[] = 'Satisfy';
	$font_family[] = 'Josefin Slab';
	$font_family[] = 'Quattrocento Sans';
	$font_family[] = 'Architects Daughter';
	$font_family[] = 'Russo One';
	$font_family[] = 'Monda';
	$font_family[] = 'Righteous';
	$font_family[] = 'Lobster Two';
	$font_family[] = 'Hammersmith One';
	$font_family[] = 'Courgette';
	$font_family[] = 'Permanent Marker';
	$font_family[] = 'Cherry Swash';
	$font_family[] = 'Cormorant Garamond';
	$font_family[] = 'Poiret One';
	$font_family[] = 'BenchNine';
	$font_family[] = 'Economica';
	$font_family[] = 'Handlee';
	$font_family[] = 'Cardo';
	$font_family[] = 'Alfa Slab One';
	$font_family[] = 'Averia Serif Libre';
	$font_family[] = 'Cookie';
	$font_family[] = 'Chewy';
	$font_family[] = 'Great Vibes';
	$font_family[] = 'Coming Soon';
	$font_family[] = 'Philosopher';
	$font_family[] = 'Days One';
	$font_family[] = 'Kanit';
	$font_family[] = 'Shrikhand';
	$font_family[] = 'Tangerine';
	$font_family[] = 'IM Fell English SC';
	$font_family[] = 'Boogaloo';
	$font_family[] = 'Bangers';
	$font_family[] = 'Fredoka One';
	$font_family[] = 'Bad Script';
	$font_family[] = 'Volkhov';
	$font_family[] = 'Shadows Into Light Two';
	$font_family[] = 'Marck Script';
	$font_family[] = 'Sacramento';
	$font_family[] = 'Unica One';
	$font_family[] = 'Kaisei HarunoUmi:wght@400;500;700';

	$query_args = array(
		'family'	=> rawurlencode(implode('|',$font_family)),
	);
	$font_url = add_query_arg($query_args,'https://fonts.googleapis.com/css');
	return $font_url;
}	

/* Theme enqueue scripts */
function pr_agency_scripts() {

	wp_enqueue_style(
		'pr-agency-font',
		pr_agency_font_url(),
		array(),
		null
	);

	wp_enqueue_style(
		'pr-agency-header-menu-css',
		get_template_directory_uri() . '/assets/css/header-menu.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);

	wp_enqueue_style(
		'pr-agency-bootstrap-css',
		get_template_directory_uri() . '/assets/css/bootstrap.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);

	wp_enqueue_style(
		'pr-agency-basic-style',
		get_stylesheet_uri(),
		array(),
		wp_get_theme()->get( 'Version' )
	);

	wp_style_add_data( 'pr-agency-basic-style', 'rtl', 'replace' );

	wp_enqueue_style(
		'pr-agency-animations',
		get_template_directory_uri() . '/assets/css/animations.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);

	wp_enqueue_style(
		'pr-agency-font-awesome',
		get_template_directory_uri() . '/assets/css/fontawesome-all.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);

	wp_enqueue_script(
		'pr-agency-bootstrap',
		get_template_directory_uri() . '/assets/js/bootstrap.js',
		array( 'jquery' ),
		wp_get_theme()->get( 'Version' ),
		true
	);

	wp_enqueue_script(
		'pr-agency-header-menu-js',
		get_template_directory_uri() . '/assets/js/header-menu.js',
		array( 'jquery' ),
		wp_get_theme()->get( 'Version' ),
		true
	);

	wp_enqueue_script(
		'pr-agency-custom',
		get_template_directory_uri() . '/assets/js/custom.js',
		array( 'jquery' ),
		wp_get_theme()->get( 'Version' ),
		true
	);

	// Paragraph
	$pr_agency_paragraph_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_paragraph_color', '') );
	$pr_agency_paragraph_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_paragraph_font_family', '') );
	$pr_agency_paragraph_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_paragraph_font_size', '') );
	// "a" tag
	$pr_agency_atag_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_atag_color', '') );
	$pr_agency_atag_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_atag_font_family', '') );
	// "li" tag
	$pr_agency_li_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_li_color', '') );
	$pr_agency_li_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_li_font_family', '') );
	// H1
	$pr_agency_h1_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h1_color', '') );
	$pr_agency_h1_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h1_font_family', '') );
	$pr_agency_h1_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h1_font_size', '') );
	// H2
	$pr_agency_h2_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h2_color', '') );
	$pr_agency_h2_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h2_font_family', '') );
	$pr_agency_h2_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h2_font_size', '') );
	// H3
	$pr_agency_h3_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h3_color', '') );
	$pr_agency_h3_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h3_font_family', '') );
	$pr_agency_h3_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h3_font_size', '') );
	// H4
	$pr_agency_h4_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h4_color', '') );
	$pr_agency_h4_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h4_font_family', '') );
	$pr_agency_h4_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h4_font_size', '') );
	// H5
	$pr_agency_h5_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h5_color', '') );
	$pr_agency_h5_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h5_font_family', '') );
	$pr_agency_h5_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h5_font_size', '') );
	// H6
	$pr_agency_h6_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h6_color', '') );
	$pr_agency_h6_font_family = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h6_font_family', '') );
	$pr_agency_h6_font_size = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_h6_font_size', '') );

	// Banner
	$pr_agency_banner_bg_color        = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_bg_color', '#2c1654' ) );
	$pr_agency_banner_heading_color   = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_heading_color', '#ffffff' ) );
	$pr_agency_banner_desc_color      = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_desc_color', '#ddd6f0' ) );
	$pr_agency_banner_btn1_color      = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_btn1_color', '#F32F73' ) );
	$pr_agency_banner_btn2_color      = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_btn2_color', '#ffffff' ) );
	$pr_agency_banner_btn2_bg         = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_btn2_bg', '#F32F73' ) );
	// Feature
	$pr_agency_featureicon_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_featureicon_color', '') );
	$pr_agency_featuretitle_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_featuretitle_color', '') );
	$pr_agency_featuretext_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_featuretext_color', '') );
	$pr_agency_featurebg_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_featurebg_color', '') );
	$pr_agency_featurebdr_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_featurebdr_color', '') );
	// Products
	$pr_agency_products_title_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_products_title_color', '') );
	$pr_agency_products_text_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_products_text_color', '') );
	$pr_agency_special_products_protitle_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_special_products_protitle_color', '') );
	$pr_agency_special_products_proprice_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_special_products_proprice_color', '') );
	// Copyright
	$pr_agency_footer_copy_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footer_copy_color', '') );
	$pr_agency_footer_copybg_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footer_copybg_color', '') );
	// Footer
	$pr_agency_footerbg_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footerbg_color', '') );
	$pr_agency_footertext_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footertext_color', '') );
	$pr_agency_footertitle_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footertitle_color', '') );
	$pr_agency_footermenu_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footermenu_color', '') );
	$pr_agency_footer_tbtext_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footer_tbtext_color', '') );
	$pr_agency_footer_tbbg_color = pr_agency_sanitize_css_value( get_theme_mod('pr_agency_footer_tbbg_color', '') );

	$pr_agency_custom_css ='
		p,span{
		    color:'.esc_html($pr_agency_paragraph_color).'!important;
		    font-family: '.esc_html($pr_agency_paragraph_font_family).';
		    font-size: '.esc_html($pr_agency_paragraph_font_size).';
		}
		a{
		    color:'.esc_html($pr_agency_atag_color).'!important;
		    font-family: '.esc_html($pr_agency_atag_font_family).';
		}
		li{
		    color:'.esc_html($pr_agency_li_color).'!important;
		    font-family: '.esc_html($pr_agency_li_font_family).';
		}
		h1{
		    color:'.esc_html($pr_agency_h1_color).'!important;
		    font-family: '.esc_html($pr_agency_h1_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h1_font_size).'!important;
		}
		h2{
		    color:'.esc_html($pr_agency_h2_color).'!important;
		    font-family: '.esc_html($pr_agency_h2_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h2_font_size).'!important;
		}
		h3{
		    color:'.esc_html($pr_agency_h3_color).'!important;
		    font-family: '.esc_html($pr_agency_h3_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h3_font_size).'!important;
		}
		h4{
		    color:'.esc_html($pr_agency_h4_color).'!important;
		    font-family: '.esc_html($pr_agency_h4_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h4_font_size).'!important;
		}
		h5{
		    color:'.esc_html($pr_agency_h5_color).'!important;
		    font-family: '.esc_html($pr_agency_h5_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h5_font_size).'!important;
		}
		h6{
		    color:'.esc_html($pr_agency_h6_color).'!important;
		    font-family: '.esc_html($pr_agency_h6_font_family).'!important;
		    font-size: '.esc_html($pr_agency_h6_font_size).'!important;
		}
		#pr-banner{
		    background-color:'.esc_html($pr_agency_banner_bg_color).'!important;
		}
		#pr-banner .pr-banner-heading{
		    color:'.esc_html($pr_agency_banner_heading_color).'!important;
		}
		#pr-banner .pr-banner-desc{
		    color:'.esc_html($pr_agency_banner_desc_color).'!important;
		}
		#pr-banner a.pr-banner-btn-outline{
		    color:'.esc_html($pr_agency_banner_btn1_color).'!important;
		}
		#pr-banner a.pr-banner-btn-primary{
		    color:'.esc_html($pr_agency_banner_btn2_color).'!important;
		    background-color:'.esc_html($pr_agency_banner_btn2_bg).'!important;
		    border-color:'.esc_html($pr_agency_banner_btn2_bg).'!important;
		}
		.feature-content .feature-box i{
		    color:'.esc_html($pr_agency_featureicon_color).'!important;
		}
		.feature-content .feature-box p.feaure-title{
		    color:'.esc_html($pr_agency_featuretitle_color).'!important;
		}
		.feature-content .feature-box p.feaure-text{
		    color:'.esc_html($pr_agency_featuretext_color).'!important;
		}
		.feature-content{
		    background-color:'.esc_html($pr_agency_featurebg_color).'!important;
		}
		.feature-content .feature-box.second-box{
		    border-left-color:'.esc_html($pr_agency_featurebdr_color).'!important;
			border-right-color:'.esc_html($pr_agency_featurebdr_color).'!important;
		}
		#special-product strong{
		    color:'.esc_html($pr_agency_products_title_color).'!important;
		}
		#special-product .product-head p{
		    color:'.esc_html($pr_agency_products_text_color).'!important;
		}
		#special-product .wc-block-components-product-title a{
		    color:'.esc_html($pr_agency_special_products_protitle_color).'!important;
		}
		#special-product .wp-block-woocommerce-product-price{
		    color:'.esc_html($pr_agency_special_products_proprice_color).'!important;
		}
		.footersec{
			background-color:'.esc_html($pr_agency_footerbg_color).'!important;
		}
		.copyright{
		    color:'.esc_html($pr_agency_footer_copy_color).'!important;
			background-color:'.esc_html($pr_agency_footer_copybg_color).'!important;
		}
		.footersec h3.widget-title{
		    color:'.esc_html($pr_agency_footertitle_color).'!important;
		}
		.footersec .widget_text p{
		    color:'.esc_html($pr_agency_footertext_color).'!important;
		}
		.widget li a, aside#categories-5 li a{
		    color:'.esc_html($pr_agency_footermenu_color).'!important;
		}
		.back-to-top{
		    color:'.esc_html($pr_agency_footer_tbtext_color).'!important;
			background-color:'.esc_html($pr_agency_footer_tbbg_color).'!important;
		}
		';

	// Banner & Breadcrumb dynamic CSS
	$pr_agency_banner_overlay  = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_overlay_color', 'rgba(0,0,0,0.55)' ) );
	$pr_agency_banner_height   = absint( get_theme_mod( 'pr_agency_banner_height', '220' ) );
	$pr_agency_banner_title_c  = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_banner_title_color', '#ffffff' ) );
	$pr_agency_breadcrumb_c    = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_breadcrumb_color', '#ffffff' ) );
	$pr_agency_breadcrumb_ac   = pr_agency_sanitize_css_value( get_theme_mod( 'pr_agency_breadcrumb_active_color', '#F32F73' ) );

	$pr_agency_custom_css .= '
		.pr-agency-page-banner { min-height: ' . $pr_agency_banner_height . 'px; }
		.page-banner-overlay { background-color: ' . esc_attr( $pr_agency_banner_overlay ) . '; }
		.page-banner-title { color: ' . esc_attr( $pr_agency_banner_title_c ) . '!important; }
		.pr-agency-breadcrumb .breadcrumb-item a,
		.pr-agency-breadcrumb .breadcrumb-item,
		.pr-agency-breadcrumb .breadcrumb-sep { color: ' . esc_attr( $pr_agency_breadcrumb_c ) . '!important; }
		.pr-agency-breadcrumb .breadcrumb-item.active { color: ' . esc_attr( $pr_agency_breadcrumb_ac ) . '!important; }
	';

	wp_add_inline_style( 'pr-agency-basic-style',$pr_agency_custom_css );
	
	require get_parent_theme_file_path( '/custom-inline-style.php' );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'pr_agency_scripts' );

require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/custom-header.php';

// Remove WooCommerce default content wrappers since theme provides its own layout in template overrides
if ( class_exists( 'WooCommerce' ) ) {
	remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
	remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
}

// =============================================
// Page Banner & Breadcrumb
// =============================================
if ( ! function_exists( 'pr_agency_render_page_banner' ) ) {
	function pr_agency_render_page_banner() {
		// Don't show on the static home-custom page template
		if ( is_page_template( 'page-template/home-custom.php' ) ) return;
		get_template_part( 'template-parts/header/page-banner' );
	}
}
add_action( 'pr_agency_page_header',   'pr_agency_render_page_banner' );
add_action( 'pr_agency_single_header', 'pr_agency_render_page_banner' );
add_action( 'pr_agency_index_header',  'pr_agency_render_page_banner' );
add_action( 'pr_agency_archive_header', 'pr_agency_render_page_banner' );
add_action( 'pr_agency_shop_header',   'pr_agency_render_page_banner' );