WordPress/wp-content/themes/twentyseventeen/front-page.php
Tammie Lister 552b119431 Twenty Seventeen: Renaming of directory structure
This changes components directory to be called template-parts. Changes reflected in all files that call those sections.

Props bronsonquick, dd32

Fixes #38375

Built from https://develop.svn.wordpress.org/trunk@38873


git-svn-id: http://core.svn.wordpress.org/trunk@38816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-23 12:07:32 +00:00

66 lines
2.1 KiB
PHP

<?php
/**
* The front page template file
*
* If the user has selected a static page for their homepage, this is what will
* appear.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php // Show the selected frontpage content.
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/page/content', 'front-page' );
endwhile;
else : // I'm not sure it's possible to have no posts when this page is shown, but WTH.
get_template_part( 'template-parts/post/content', 'none' );
endif; ?>
<?php
// Get each of our panels and show the post data.
$panels = array( '1', '2', '3', '4' );
$titles = array();
global $twentyseventeencounter; // Used in template-parts/page/content-front-page-panels.php file.
if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show.
$twentyseventeencounter = 1;
foreach ( $panels as $panel ) :
if ( get_theme_mod( 'panel_' . $panel ) ) :
$post = get_post( get_theme_mod( 'panel_' . $panel ) );
setup_postdata( $post );
set_query_var( 'panel', $panel );
$titles[] = get_the_title(); // Put page titles in an array for use in navigation.
get_template_part( 'template-parts/page/content', 'front-page-panels' );
wp_reset_postdata();
else :
// The output placeholder anchor.
echo '<article class="panel-placeholder panel twentyseventeen-panel twentyseventeen-panel' . esc_attr( $twentyseventeencounter ) . '" id="panel' . esc_attr( $twentyseventeencounter ) . '"><span class="twentyseventeen-panel-title">' . sprintf( __( 'Panel %1$s Placeholder', 'twentyseventeen' ), esc_attr( $twentyseventeencounter ) ) . '</span></article>';
endif;
$twentyseventeencounter++;
endforeach;
?>
<?php endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer();