loop-banner.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Banner / Featured content loop
  4. * @package Dyad
  5. */
  6. ?>
  7. <div id="site-banner" class="site-banner<?php if ( ( is_front_page() || is_home() ) && dyad_2_has_banner_posts( 2 ) ) { echo ' enable-slider'; } else { echo ' no-slider'; } ?>">
  8. <div class="site-banner-inner">
  9. <?php
  10. if ( ( is_front_page() && is_page() && has_post_thumbnail() ) || ( is_single() && 'image' == get_post_format() ) ) {
  11. // if front page is static page or if this is single image post and has a featured image, display that.
  12. get_template_part( 'template-parts/content', 'featured-img' );
  13. } else if ( dyad_2_has_banner_posts( 1 ) ) {
  14. // if there are featured posts, display those as a slideshow
  15. $featured_posts = dyad_2_get_banner_posts();
  16. foreach ( (array) $featured_posts as $order => $post ) {
  17. setup_postdata( $post );
  18. get_template_part( 'template-parts/content', 'featured-post' );
  19. }
  20. wp_reset_postdata();
  21. } else {
  22. //Fall back to Custom Header
  23. get_template_part( 'template-parts/content', 'custom-header' );
  24. } ?>
  25. </div><!-- .site-banner-inner -->
  26. </div><!-- #site-banner -->