<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package elinalite
 */

get_header();

$enable_galleries = get_theme_mod( 'elinalite-enable-galleries', true );

if ( $enable_galleries ) : 
?>
    <!-- Wrapper -->
    <div id="home"> 
        <!-- Portfolio -->
        <section id="primary">
            <div class="portfolio-grid owl-carousel owl-theme">
                <?php do_action( 'firstgal' ); ?>
                <?php do_action( 'secndgal' ); ?>
                <?php do_action( 'thirdgal' ); ?>
                <?php do_action( 'fourtgal' ); ?>
                <?php do_action( 'fifthgal' ); ?>      
            </div>
        </section>
    </div> <!-- End Wrapper -->
<?php 
endif;

$disable_post_galleries = get_theme_mod('elinalite-disable-post-page', false);

if ( !$disable_post_galleries ) {
    // If the 'Disable Post Galleries' is not checked, run the default behavior
    if ( 'posts' == get_option( 'show_on_front' ) ) {
        include( get_home_template() );
    } else {
        include( get_page_template() );
    }
} else {
    // If 'Disable Post Galleries' is checked, bypass the code or implement an alternative action
    // This part can remain empty or handle alternative logic
}

get_footer();
?>

