single.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Single post template
  4. *
  5. * @package vamtam/consulting
  6. */
  7. get_header();
  8. ?>
  9. <?php
  10. if ( have_posts() ) :
  11. while ( have_posts() ) : the_post(); ?>
  12. <div class="row page-wrapper">
  13. <?php VamtamTemplates::$in_page_wrapper = true; ?>
  14. <article <?php post_class( 'single-post-wrapper ' . VamtamTemplates::get_layout() )?>>
  15. <div class="page-content loop-wrapper clearfix full">
  16. <?php get_template_part( 'templates/post' ); ?>
  17. <?php comments_template(); ?>
  18. </div>
  19. </article>
  20. <?php get_template_part( 'sidebar' ) ?>
  21. </div>
  22. <?php if ( ( rd_vamtam_get_optionb( 'show-related-posts' ) || is_customize_preview() ) && is_singular( 'post' ) && class_exists( 'VamtamBlogModule' ) ) : ?>
  23. <?php if ( ! class_exists( 'Vamtam_Elements_B' ) || Vamtam_Elements_B::had_limit_wrapper() ) : ?>
  24. </div>
  25. <?php endif ?>
  26. <?php
  27. $terms = array();
  28. $cats = get_the_category();
  29. foreach ( $cats as $cat ) {
  30. $terms[] = $cat->term_id;
  31. }
  32. $related_query = new WP_Query( array(
  33. 'post_type' => 'post',
  34. 'category__in' => $terms,
  35. 'post__not_in' => array( get_the_ID() ),
  36. 'posts_per_page' => 1,
  37. ) );
  38. if ( intval( $related_query->found_posts ) > 0 ) :
  39. ?>
  40. <div class="related-posts row vamtam-related-content" <?php VamtamTemplates::display_none( rd_vamtam_get_optionb( 'show-related-posts' ) ) ?>>
  41. <div class="clearfix limit-wrapper vamtam-box-outer-padding">
  42. <div class="grid-1-1">
  43. <?php echo wp_kses_post( apply_filters( 'vamtam_related_posts_title', '<h5 class="related-content-title">' . rd_vamtam_get_option( 'related-posts-title' ) . '</h5>' ) ); ?>
  44. <?php
  45. FLBuilder::render_module_html( 'vamtam-blog', array(
  46. 'count' => 8,
  47. 'columns' => 4,
  48. 'tax_post_category' => implode( ',', $terms ),
  49. 'layout' => 'scroll-x',
  50. 'show_title' => true,
  51. 'show_content' => true,
  52. 'posts_post' => get_the_ID(),
  53. 'posts_post_matching' => 0,
  54. ) );
  55. ?>
  56. </div>
  57. </div>
  58. </div>
  59. <?php endif ?>
  60. <?php if ( ! class_exists( 'Vamtam_Elements_B' ) || Vamtam_Elements_B::had_limit_wrapper() ) : ?>
  61. <div class="limit-wrapper">
  62. <?php endif ?>
  63. <?php endif ?>
  64. <?php endwhile;
  65. endif;
  66. get_footer();