Twenty Fourteen: allow any page to be set as the front page, removing requirement for front-page.php template file. Props iamtakashi, fixes #25685.

git-svn-id: https://develop.svn.wordpress.org/trunk@25985 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2013-10-29 19:05:02 +00:00
parent 6b711ca35e
commit e575c315fb
14 changed files with 140 additions and 147 deletions

View File

@ -9,6 +9,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -24,8 +25,9 @@ get_header(); ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -19,6 +19,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -59,8 +60,9 @@ get_header(); ?>
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -11,6 +11,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -43,8 +44,9 @@ get_header(); ?>
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -9,6 +9,13 @@
get_header(); ?>
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() )
get_template_part( 'featured-content' );
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
@ -34,6 +41,7 @@ get_header(); ?>
?>
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main-content -->
<?php
get_sidebar();

View File

@ -1,46 +0,0 @@
<?php
/**
* The template for displaying the home page
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
get_header(); ?>
<div class="front-page-content-wrapper">
<?php
if ( twentyfourteen_has_featured_posts() )
get_template_part( 'featured-content' );
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
comments_template();
endwhile;
twentyfourteen_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
<?php get_sidebar( 'content' ); ?>
</div><!-- .front-page-content-wrapper -->
<?php
get_sidebar();
get_footer();

View File

@ -9,6 +9,13 @@
get_header(); ?>
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() )
get_template_part( 'featured-content' );
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
@ -24,6 +31,7 @@ get_header(); ?>
?>
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main-content -->
<?php
get_sidebar();

View File

@ -12,78 +12,80 @@ $metadata = wp_get_attachment_metadata();
get_header();
?>
<section id="primary" class="content-area image-attachment">
<div id="content" class="site-content" role="main">
<div id="main-content" class="main-content">
<section id="primary" class="content-area image-attachment">
<div id="content" class="site-content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<div class="entry-meta">
<div class="entry-meta">
<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
<span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span>
<span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span>
<span class="parent-post-link"><a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<span class="parent-post-link"><a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php twentyfourteen_the_attached_image(); ?>
</div><!-- .attachment -->
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php twentyfourteen_the_attached_image(); ?>
</div><!-- .attachment -->
<?php if ( has_excerpt() ) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php if ( has_excerpt() ) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php
if ( comments_open() && pings_open() ) : // Comments and trackbacks open
printf( __( '<a class="comment-link" href="#respond">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open
printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( comments_open() && ! pings_open() ) : // Only comments open
_e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond">post a comment</a>.', 'twentyfourteen' );
elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed
_e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' );
endif;
?>
</footer><!-- .entry-meta -->
</article><!-- #post-## -->
<footer class="entry-meta">
<?php
if ( comments_open() && pings_open() ) : // Comments and trackbacks open
printf( __( '<a class="comment-link" href="#respond">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open
printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" rel="trackback">Trackback URL</a>.', 'twentyfourteen' ), get_trackback_url() );
elseif ( comments_open() && ! pings_open() ) : // Only comments open
_e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond">post a comment</a>.', 'twentyfourteen' );
elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed
_e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' );
endif;
?>
</footer><!-- .entry-meta -->
</article><!-- #post-## -->
<nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links">
<?php previous_image_link( false, __( '<div class="previous-image">Previous Image</div>', 'twentyfourteen' ) ); ?>
<?php next_image_link( false, __( '<div class="next-image">Next Image</div>', 'twentyfourteen' ) ); ?>
</div><!-- .nav-links -->
</nav><!-- #image-navigation -->
<nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links">
<?php previous_image_link( false, __( '<div class="previous-image">Previous Image</div>', 'twentyfourteen' ) ); ?>
<?php next_image_link( false, __( '<div class="next-image">Next Image</div>', 'twentyfourteen' ) ); ?>
</div><!-- .nav-links -->
</nav><!-- #image-navigation -->
<?php comments_template(); ?>
<?php comments_template(); ?>
<?php endwhile; // end of the loop. ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</section><!-- #primary -->
</div><!-- #content -->
</section><!-- #primary -->
</div><!-- #main-content -->
<?php
get_sidebar();

View File

@ -15,6 +15,13 @@
get_header(); ?>
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() )
get_template_part( 'featured-content' );
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -35,8 +42,9 @@ get_header(); ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -13,6 +13,12 @@
get_header(); ?>
<div id="main-content" class="main-content">
<?php
if ( is_front_page() && twentyfourteen_has_featured_posts() )
get_template_part( 'featured-content' );
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -30,8 +36,9 @@ get_header(); ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -9,6 +9,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -34,8 +35,10 @@ get_header(); ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -9,25 +9,27 @@
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
while ( have_posts() ) :
the_post();
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
get_template_part( 'content', get_post_format() );
twentyfourteen_post_nav();
twentyfourteen_post_nav();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() )
comments_template();
endwhile;
?>
</div><!-- #content -->
</div><!-- #primary -->
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() )
comments_template();
endwhile;
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -13,7 +13,6 @@ This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
/**
* Table of Contents:
*
@ -34,9 +33,8 @@ Use it to make something cool, have fun, and share what you've learned with othe
* 6.8 - Archives
* 6.9 - Contributor Page
* 6.10 - 404 Page
* 6.11 - Front Page
* 6.12 - Full-width
* 6.13 - Comments
* 6.11 - Full-width
* 6.12 - Comments
* 7.0 - Sidebar
* 7.1 - Widgets
* 7.2 - Content Sidebar Widgets
@ -770,6 +768,10 @@ span + .edit-link:before,
position: relative;
}
.main-content {
width: 100%;
}
/**
* 4.0 Header
@ -1721,17 +1723,7 @@ a.post-thumbnail:hover {
/**
* 6.11 Front Page
* -----------------------------------------------------------------------------
*/
.front-page-content-wrapper {
width: 100%;
}
/**
* 6.12 Full-width
* 6.11 Full-width
* -----------------------------------------------------------------------------
*/
@ -1754,7 +1746,7 @@ a.post-thumbnail:hover {
/**
* 6.13 Comments
* 6.12 Comments
* -----------------------------------------------------------------------------
*/
@ -3243,6 +3235,10 @@ a.post-thumbnail:hover {
padding-left: 182px;
}
.main-content {
float: left;
}
.site-content {
margin: 0 29.04761904% 0 182px;
}
@ -3377,10 +3373,6 @@ a.post-thumbnail:hover {
width: 25%;
}
.front-page-content-wrapper {
float: left;
}
.featured-content {
padding-left: 182px;
}

View File

@ -13,6 +13,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -45,8 +46,9 @@ get_header(); ?>
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -15,6 +15,7 @@
get_header(); ?>
<div id="main-content" class="main-content">
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
@ -64,8 +65,8 @@ get_header(); ?>
?>
</div><!-- #content -->
</section><!-- #primary -->
</div><!-- #main-content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();