<?php
/**
 * @package Bio Green Farm
 */

function Bio_Green_Farm_Customizer_add_defaults( $default_options) {
	$defaults = array(
		'bio_green_farm_excerpt_length'    => 30,
	);
	$updated_defaults = wp_parse_args( $defaults, $default_options );

	return $updated_defaults;
}
add_filter( 'Bio_Green_Farm_Customizer_defaults', 'Bio_Green_Farm_Customizer_add_defaults' );

function bio_green_farm_gtm( $option ) {
	$defaults = apply_filters( 'Bio_Green_Farm_Customizer_defaults', true );

	return isset( $defaults[ $option ] ) ? get_theme_mod( $option, $defaults[ $option ] ) : get_theme_mod( $option );
}

if ( ! function_exists( 'bio_green_farm_excerpt_length' ) ) :
	function bio_green_farm_excerpt_length( $length ) {
		if ( is_admin() ) {
			return $length;
		}

		$length	= bio_green_farm_gtm( 'bio_green_farm_excerpt_length' );

		return absint( $length );
	} 
endif;
add_filter( 'excerpt_length', 'bio_green_farm_excerpt_length', 999 );