front-page.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * The front page template file
  4. *
  5. * If the user has selected a static page for their homepage, this is what will
  6. * appear.
  7. * Learn more: https://codex.wordpress.org/Template_Hierarchy
  8. *
  9. * @package WordPress
  10. * @subpackage Twenty_Seventeen
  11. * @since 1.0
  12. * @version 1.0
  13. */
  14. get_header(); ?>
  15. <div id="primary" class="content-area">
  16. <main id="main" class="site-main" role="main">
  17. <?php // Show the selected frontpage content.
  18. if ( have_posts() ) :
  19. while ( have_posts() ) : the_post();
  20. get_template_part( 'template-parts/page/content', 'front-page' );
  21. endwhile;
  22. else :
  23. get_template_part( 'template-parts/post/content', 'none' );
  24. endif; ?>
  25. <?php
  26. // Get each of our panels and show the post data.
  27. if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show.
  28. /**
  29. * Filter number of front page sections in Twenty Seventeen.
  30. *
  31. * @since Twenty Seventeen 1.0
  32. *
  33. * @param int $num_sections Number of front page sections.
  34. */
  35. $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 );
  36. global $twentyseventeencounter;
  37. // Create a setting and control for each of the sections available in the theme.
  38. for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
  39. $twentyseventeencounter = $i;
  40. twentyseventeen_front_page_section( null, $i );
  41. }
  42. endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. ?>
  43. </main><!-- #main -->
  44. </div><!-- #primary -->
  45. <?php get_footer();