View file StuffPost/stuffpost/parts/post-content.php

File size: 6.44Kb
<?php /* ELements for the main content of the articles */ ?>

<!-- /* EXCERPT */ -->
  <div class="lead c-meta mb-4 f-main"><?php the_excerpt(); ?></div>

<!-- /* FEATURED IMG or VIDEO */ -->
  <?php if(get_theme_mod('want_featured_img',1)){ ?>
    <?php if(get_post_meta($post->ID, "weart_video_audio", true) && !is_page_template( 'single-video.php' )) { ?>
      <div class="featured-img embed-responsive embed-responsive-16by9 mb-4"><?php echo get_post_meta($post->ID, "weart_video_audio", true); ?></div>
    <?php } else{?>
      <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) && !is_page_template( 'single-video.php' ) ) : ?>
        <div class="featured-img mb-4"><img src="<?php the_post_thumbnail_url( 'weart-featured' ); ?>" alt="<?php the_title(); ?>" /></div>
      <?php endif; ?>
    <?php } ?><!-- featured-img-video -->
  <?php } ?>

<!-- /* CONTENT */ -->
  <div class="post-content l-1 lh-black mb-4 clearfix"><?php the_content(); ?></div>

<!-- /* LINK PAGES */ -->
  <?php wp_link_pages( array(
    'before' => '<div class="link-pages c-meta l-black clearfix text-center t-md"><hr>',
    'after' => '</div>',
    'link_before' => '<span class="c-black text-uppercase font-weight-bold f-title">',
    'link_after' => '</span>',
    'separator' => ' - ' ) ); ?>

<!-- /* POST SHARE */ -->
  <div class="post-share row">
    <div class="col-lg-6">
      <div class="post-pagination clearfix">
        <?php $prev_post = get_previous_post(true); ?>
        <?php if (!empty( $prev_post )): ?>
          <a href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>" class="d-inline-block c-black">
            <i class="fas fa-angle-left"></i>
          </a>
        <?php endif; ?>
        <?php $next_post = get_next_post(true); ?>
        <?php if (!empty( $next_post )): ?>
          <a href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>" class="d-inline-block c-black">
            <i class="fas fa-angle-right"></i>
          </a>
        <?php endif; ?>
      </div><!-- .post-pagination -->
    </div><!-- .col-lg-6 -->
    <div class="col"><?php if ( shortcode_exists( 'ssba-buttons' ) ) { echo do_shortcode('[ssba-buttons]'); } ?></div>
  </div><!-- .post-share -->

<!-- /* cat and tags */ -->
  <hr class="mt-2">
  <div class="post-tags clearfix f-title l-black c-meta f-main">
    <span class="category float-left"><?php esc_html_e('Categories: ','stuffpost'); the_category(', '); ?></span>
    <span class="tags float-right"><?php the_tags(); ?></span>
  </div><!-- .post-tags -->

<!-- /* Authors */ -->
  <?php if( get_the_author_meta('description') ): ?>
    <div class="row my-5 post-author">
      <div class="float-left mx-2">
        <img src="<?php echo esc_html( get_avatar_url( get_the_author_meta('user_email'), array( 'size' => 48 )) ); ?>" class="rounded-circle" alt="" />
        <div class="clearfix small l-meta text-center mt-1">
          <?php if(get_the_author_meta('email')){  ?>
            <a href="mailto:<?php esc_html( the_author_meta('email') ); ?>" class="meta"><i class="fas fa-envelope-square" aria-hidden="true"></i></a>
          <?php } if(get_the_author_meta('user_url')){  ?>
            <a href="<?php esc_html( the_author_meta('user_url') ); ?>" class="meta"><i class="fas fa-external-link-square-alt" aria-hidden="true"></i></a>
          <?php }  ?>
        </div>
      </div>
      <div class="col">
        <div class="title mb-1 mb-2">
          <h4 class="f-title h5 l-black lh-1  text-uppercase">
            <span class="bg-white pr-3"><?php the_author_posts_link(); ?></span>
          </h4>
        </div>
        <?php if(get_the_author_meta('description')){  ?><div class="small f-text c-meta p-m-0"><?php the_author_meta('description'); ?></div><?php }  ?>
      </div>
    </div>
  <?php endif; ?>

<!-- /* BANNER */ -->
  <?php if(get_theme_mod('want_articleBanner',0)){ ?>
    <?php weart_bannerArticle(); ?>
  <?php } ?>

<!-- /* RELATED */ -->
  <?php if (get_theme_mod( 'want_related', 0 )) { ?>
    <div class="post-related-title"><?php weart_sectionTitle(array('font'=>'h5','title'=>esc_html__('Related Articles','stuffpost'))); ?></div>
    <div id="post-related" class="carousel slide post-related mt-2" data-ride="carousel">
      <div class="carousel-inner">
        <?php // category posts
          $categories = get_the_category($post->ID);
          if($categories) {
            $category_ids = array();
            foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
            $args=array(
              'category__in' => $category_ids,
              'post__not_in' => array($post->ID),
              'posts_per_page'=> 12, // Number of related posts that will be shown.
              'ignore_sticky_posts'=>1,
              'orderby'=>'rand',
              'order'=> 'DESC',
            );
          }
          $i = 0; $section_posts = get_posts( $args );
          if ($section_posts) {
        ?>
          <div class="carousel-item active">
            <div class="row no-gutters">
            <?php $i=0; foreach ( $section_posts as $post ) : setup_postdata( $post ); if($i<6): ?>
              <div class="col-md-4 col-xs-6"><?php weart_itemInner(array('bg'=>'bg-100','font'=>'h6','cat'=>0,'by'=>0)) ?></div>
            <?php endif; $i++; endforeach; wp_reset_postdata(); ?>
            </div>
          </div><!-- .carousel-item -->
          <div class="carousel-item">
            <div class="row no-gutters">
              <?php $i=0; foreach ( $section_posts as $post ) : setup_postdata( $post ); if($i>=6): ?>
                <div class="col-md-4 col-xs-6"><?php weart_itemInner(array('bg'=>'bg-100','font'=>'h6','cat'=>0,'by'=>0)) ?></div>
              <?php endif; $i++; endforeach; wp_reset_postdata(); ?>
            </div>
          </div><!-- .carousel-item -->
        <?php } ?>
      </div><!-- .carosuel-inner -->
      <a class="carousel-control-prev" href="#post-related" role="button" data-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      </a>
      <a class="carousel-control-next" href="#post-related" role="button" data-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
      </a>
    </div><!-- .#post-related -->
  <?php } ?>

<!-- /* COMMENTS */ -->
  <div class="post-comments clearfix mt-5 small"><?php comments_template( '', true );  ?></div>