&lt;?php
/**
 *
 * Front Page
 *
 * @package PrimeBulletin
 */

get_header();


    $primebulletin_default = primebulletin_get_default_theme_options();
    $primebulletin_default = primebulletin_get_default_theme_options();
    $sidebar = esc_attr( get_theme_mod( &#039;global_sidebar_layout&#039;, $primebulletin_default[&#039;global_sidebar_layout&#039;] ) );
    

    if( is_single() || is_page() ){

        $primebulletin_post_sidebar = esc_attr( get_post_meta( $post-&gt;ID, &#039;primebulletin_post_sidebar_option&#039;, true ) );
        if( $primebulletin_post_sidebar == &#039;global-sidebar&#039; || empty( $primebulletin_post_sidebar ) ){

            $sidebar = $sidebar;
        }else{
            $sidebar = $primebulletin_post_sidebar;
        }

    }
    $twp_primebulletin_home_sections_33 = get_theme_mod( &#039;twp_primebulletin_home_sections_33&#039;, json_encode( $primebulletin_default[&#039;twp_primebulletin_home_sections_33&#039;] ) );
    $paged_active = false;

    if ( !is_paged() ) {
        $paged_active = true;
    }

    $twp_primebulletin_home_sections_33 = json_decode( $twp_primebulletin_home_sections_33 );

    if( $twp_primebulletin_home_sections_33 ){ ?&gt;

        &lt;div class=&quot;wrapper&quot;&gt;
            &lt;div class=&quot;column-row&quot;&gt;

                &lt;div id=&quot;primary&quot; class=&quot;content-area&quot;&gt;
                    &lt;main id=&quot;main&quot; class=&quot;site-main&quot; role=&quot;main&quot;&gt;

                        &lt;?php
                        foreach ( $twp_primebulletin_home_sections_33 as $primebulletin_home_section ) {

                            $home_section_type = isset( $primebulletin_home_section-&gt;home_section_type ) ? $primebulletin_home_section-&gt;home_section_type : &#039;&#039;;

                            switch ($home_section_type) {

                                case &#039;main-banner&#039;:

                                    $ed_slider_blocks = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_slider_blocks == &#039;yes&#039; &amp;&amp; $paged_active ) {
                                        primebulletin_main_banner( $primebulletin_home_section );
                                    }

                                break;

                                case &#039;latest-posts-blocks&#039;:

                                    $ed_latest_posts_blocks = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_latest_posts_blocks == &#039;yes&#039; ) {
                                        primebulletin_latest_blocks( $primebulletin_home_section );
                                    }

                                break;

                                case &#039;tiles-blocks&#039;:

                                    $ed_tiles_block = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_tiles_block == &#039;yes&#039; &amp;&amp; $paged_active ) {
                                        primebulletin_tiles_block_section( $primebulletin_home_section );
                                    }

                                break;

                                case &#039;banner-blocks-1&#039;:

                                    $ed_banner_blocks_1 = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_banner_blocks_1 == &#039;yes&#039; &amp;&amp; $paged_active ) {
                                        primebulletin_banner_block_1_section( $primebulletin_home_section );
                                    }

                                break;

                                case &#039;advertise-blocks&#039;:

                                    $ed_advertise_blocks = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_advertise_blocks == &#039;yes&#039; &amp;&amp; $paged_active ) {
                                        primebulletin_advertise_block( $primebulletin_home_section );
                                    }
                                    
                                break;

                                case &#039;home-widget-area&#039;:

                                    $ed_home_widget_area = isset( $primebulletin_home_section-&gt;section_ed ) ? $primebulletin_home_section-&gt;section_ed : &#039;&#039;;
                                    if ( $ed_home_widget_area == &#039;yes&#039; &amp;&amp; $paged_active ) {
                                        primebulletin_case_home_widget_area_block( $primebulletin_home_section );
                                    }
                                    
                                break;

                                default:

                                break;

                            }

                        } ?&gt;

                    &lt;/main&gt;&lt;!-- #main --&gt;
                &lt;/div&gt;

                &lt;?php if( $sidebar != &#039;no-sidebar&#039; ){

                get_sidebar();

                } ?&gt;

            &lt;/div&gt;
        &lt;/div&gt;

    &lt;?php
    }

get_footer();
