single.php 1.61 KB
Newer Older
Pham Huy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
<?php 
    
    get_header();

    $meta = get_post_meta( $post->ID, 'offshore_options', true );

    if( !isset( $meta['template'] ) ){
        $meta['template'] = 'global';
    }

    $column = 'col-md-9';

    if( 'full-width' == get_theme_mod( 'page_template', 'right-sidebar' ) && $meta['template'] == 'global' ){
        $column = 'col-md-12';
    } elseif( $meta['template'] == 'full-width' ) {
        $column = 'col-md-12';
    }

?>
    <div class="row">

        <?php 
            if( 'left-sidebar' == get_theme_mod( 'page_template', 'right-sidebar' ) && $meta['template'] == 'global' ){
                get_sidebar();
            } elseif( $meta['template'] == 'left-sidebar' ) {
                get_sidebar();
            }

            if( 'no-sidebar' == get_theme_mod( 'page_template', 'right-sidebar' ) && $meta['template'] == 'global' ) {
                $column = 'col-md-12';
            } elseif( $meta['template'] == 'no-sidebar' ) {
                $column = 'col-md-12';
            }
        ?>

        <div class="<?php echo $column; ?> content">

            <?php 

                offshore_content_top();

                get_template_part( 'parts/content', 'post' );

                offshore_content_bottom();

            ?>
                
        </div>

        <?php 
            if( 'right-sidebar' == get_theme_mod( 'page_template', 'right-sidebar' ) && $meta['template'] == 'global' ) {
                get_sidebar();
            } elseif( $meta['template'] == 'right-sidebar' ) {
                get_sidebar();
            }
        ?>

    </div>

<?php 

offshore_content_after();

get_footer(); 

?>