content-post.php 2.81 KB
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php 

    global $post;

    if( isset($post) ){
        $meta = get_post_meta( $post->ID, 'offshore_options', true );
    } else {
        $meta = array();
    }

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

    offshore_entry_before(); ?>
    
        <article <?php post_class(); ?> id="post-<?php esc_attr( the_ID() ); ?>">
            
            <?php offshore_entry_top();

                the_content( esc_html__( 'Read more &raquo;', 'offshore' ) );

                if( 'services' != get_post_type() ) {

                    if( '0' == get_theme_mod( 'hide_share_buttons', '0' ) && $meta['hide_share_buttons'] == 'global' || $meta['hide_share_buttons'] == 'no' ){

                            echo '<div class="social-share text-center">
                                    <a class="fb-share" href="http://www.facebook.com/sharer/sharer.php?u=' . urlencode( get_permalink() ) . '&t='. urlencode( get_the_title() ) .'"> <i class="fa fa-facebook" aria-hidden="true"></i>' . esc_html__( 'Share on Facebook', 'offshore' ) . '</a>
                                    <a class="tweet-share" href="https://twitter.com/share?url=' . urlencode( get_permalink() ) . '&text='. urlencode( get_the_title() ) .'"> <i class="fa fa-twitter" aria-hidden="true"></i>' . esc_html__( 'Share on Twitter', 'offshore' ) . '</a>
                                </div>';
                        }
                }

                get_template_part( 'parts/part', 'link-pages' );

            offshore_entry_bottom();

            if( 'services' != get_post_type() ) {
                if( !isset( $meta['hide_post_author_box'] ) ){
                    $meta['hide_post_author_box'] = 'global';
                }
                if( '0' == get_theme_mod( 'hide_post_author_box', '0' ) && $meta['hide_post_author_box'] == 'global' || $meta['hide_post_author_box'] == 'no' ){
                    get_template_part( 'parts/part', 'authormetadata' );
                }
            }

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

            if( 'full-width' == get_theme_mod( 'page_template', 'right-sidebar' ) && $meta['template'] == 'global' || $meta['template'] == 'full-width' ) {
                echo '<p class="text-center">';
                edit_post_link();
                echo '</p>';
            } else {
                edit_post_link();
            }
            
            if ( comments_open() ) { ?>
                
                <div id="comments" class="comments">
                    
                    <?php comments_template(); ?>
                
                </div>

            <?php } ?>

        </article>

    <?php offshore_entry_after();

endwhile; endif; ?>