
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php

/* -----------------------------------------------------------------------------
 * Proxy function
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_the_excerpt' ) ) {
	function presso_the_excerpt( $length = null ) {
		presso_set_excerpt_length( $length );

		the_excerpt();

		presso_reset_excerpt_length();
	}
}


/* -----------------------------------------------------------------------------
 * Add Custom Excerpt More
 * -------------------------------------------------------------------------- */
add_filter( 'excerpt_more', 'presso_custom_excerpt_more' );
if ( ! function_exists( 'presso_custom_excerpt_more' ) ) {
	function presso_custom_excerpt_more( $more ) {
		return ' ...';
	}
}


/* -----------------------------------------------------------------------------
 * Add Custom Excerpt Length
 * -------------------------------------------------------------------------- */
add_filter( 'excerpt_length', 'presso_get_excerpt_length' );
add_action( 'after_setup_theme', 'presso_reset_excerpt_length' );

if ( ! function_exists( 'presso_get_excerpt_length' ) ) {
	function presso_get_excerpt_length( $length ) {
		global $presso_custom_excerpt_length;

		if ( empty( $presso_custom_excerpt_length ) ) {
			return $length;

		} else {
			return $presso_custom_excerpt_length;
			
		}
	}
}

if ( ! function_exists( 'presso_set_excerpt_length' ) ) {
	function presso_set_excerpt_length( $length = null ) {
		global $presso_custom_excerpt_length;
		$presso_custom_excerpt_length = $length;
	}
}

if ( ! function_exists( 'presso_set_double_excerpt_length' ) ) {
	function presso_set_double_excerpt_length() {
		global $presso_custom_excerpt_length;
		$presso_custom_excerpt_length *= 2;
	}
}

if ( ! function_exists( 'presso_reset_excerpt_length' ) ) {
	function presso_reset_excerpt_length() {
		presso_set_excerpt_length( intval( presso_get_theme_option( 'blog_excerpt_length' ) ) );
	}
}