<?php
if( ! function_exists( 'moment_excerpt_length' ) ) :

    /**
     * Excerpt length
     *
     * @since  Moment 1.0.0
     *
     * @param null
     * @return int
     */
    function moment_excerpt_length( $length ){
        global $moment_customizer_all_values;
        $excerpt_length = $moment_customizer_all_values['moment-number-of-words'];
        if ( empty( $excerpt_length) ) {
            $excerpt_length = $length;
        }
        return esc_attr( $excerpt_length );

    }

endif;
add_filter( 'excerpt_length', 'moment_excerpt_length', 999 );