front-page.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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://developer.wordpress.org/themes/basics/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
  18. // Show the selected front page content.
  19. if ( have_posts() ) :
  20. while ( have_posts() ) :
  21. the_post();
  22. get_template_part( 'template-parts/page/content', 'front-page' );
  23. endwhile;
  24. else :
  25. get_template_part( 'template-parts/post/content', 'none' );
  26. endif;
  27. ?>
  28. <?php
  29. // Get each of our panels and show the post data.
  30. if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show.
  31. /**
  32. * Filter number of front page sections in Twenty Seventeen.
  33. *
  34. * @since Twenty Seventeen 1.0
  35. *
  36. * @param int $num_sections Number of front page sections.
  37. */
  38. $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 );
  39. global $twentyseventeencounter;
  40. // Create a setting and control for each of the sections available in the theme.
  41. for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
  42. $twentyseventeencounter = $i;
  43. twentyseventeen_front_page_section( null, $i );
  44. }
  45. endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here.
  46. ?>
  47. </main><!-- #main -->
  48. </div><!-- #primary -->
  49. <?php
  50. get_footer();