<?php
/**
 * check if all sections of front page disable
 *
 * @since Moment Pro 1.0.0
 */
if ( ! function_exists( 'moment_if_all_disable' ) ) :
    function moment_if_all_disable() {
        global $moment_customizer_all_values;
        if(
            1 != $moment_customizer_all_values['moment-home-showcase-enable'] &&
            1 != $moment_customizer_all_values['moment-home-popular-photo-section-enable']
        )
        {
            return 0;
        }
        else{
            return 1;
        }
    }
endif;
if ( ! function_exists( 'moment_front_page' ) ) :
    /**
     * Before main content
     *
     * @since Moment 1.0.0
     *
     * @param null
     * @return null
     *
     */
    function moment_front_page() {
        if ( 'posts' == get_option( 'show_on_front' ) ) {
            include( get_home_template() );
        }
        elseif( 1 == moment_if_all_disable()){
            /**
             * homepage hook
             * @since Moment 1.0.0
             *
             */
            do_action('moment_homepage');
        }
        else {
            include( get_page_template() );
        }

    }
endif;
add_action( 'moment_action_front_page', 'moment_front_page', 10 );