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

View File

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

View File

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

View File

@ -9,6 +9,13 @@
get_header(); ?> 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="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
<?php <?php
@ -34,6 +41,7 @@ get_header(); ?>
?> ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->
</div><!-- #main-content -->
<?php <?php
get_sidebar(); 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(); ?> 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="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
<?php <?php
@ -24,6 +31,7 @@ get_header(); ?>
?> ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->
</div><!-- #main-content -->
<?php <?php
get_sidebar(); get_sidebar();

View File

@ -12,78 +12,80 @@ $metadata = wp_get_attachment_metadata();
get_header(); get_header();
?> ?>
<section id="primary" class="content-area image-attachment"> <div id="main-content" class="main-content">
<div id="content" class="site-content" role="main"> <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(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"> <header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> <?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> <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>' ); ?> <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
</header><!-- .entry-header --> </header><!-- .entry-header -->
<div class="entry-content"> <div class="entry-content">
<div class="entry-attachment"> <div class="entry-attachment">
<div class="attachment"> <div class="attachment">
<?php twentyfourteen_the_attached_image(); ?> <?php twentyfourteen_the_attached_image(); ?>
</div><!-- .attachment --> </div><!-- .attachment -->
<?php if ( has_excerpt() ) : ?> <?php if ( has_excerpt() ) : ?>
<div class="entry-caption"> <div class="entry-caption">
<?php the_excerpt(); ?> <?php the_excerpt(); ?>
</div><!-- .entry-caption --> </div><!-- .entry-caption -->
<?php endif; ?> <?php endif; ?>
</div><!-- .entry-attachment --> </div><!-- .entry-attachment -->
<?php <?php
the_content(); the_content();
wp_link_pages( array( wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
'after' => '</div>', 'after' => '</div>',
'link_before' => '<span>', 'link_before' => '<span>',
'link_after' => '</span>', 'link_after' => '</span>',
) ); ) );
?> ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->
<footer class="entry-meta"> <footer class="entry-meta">
<?php <?php
if ( comments_open() && pings_open() ) : // Comments and trackbacks open 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() ); 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 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() ); 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 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' ); _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 elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed
_e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' ); _e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' );
endif; endif;
?> ?>
</footer><!-- .entry-meta --> </footer><!-- .entry-meta -->
</article><!-- #post-## --> </article><!-- #post-## -->
<nav id="image-navigation" class="navigation image-navigation"> <nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links"> <div class="nav-links">
<?php previous_image_link( false, __( '<div class="previous-image">Previous Image</div>', 'twentyfourteen' ) ); ?> <?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' ) ); ?> <?php next_image_link( false, __( '<div class="next-image">Next Image</div>', 'twentyfourteen' ) ); ?>
</div><!-- .nav-links --> </div><!-- .nav-links -->
</nav><!-- #image-navigation --> </nav><!-- #image-navigation -->
<?php comments_template(); ?> <?php comments_template(); ?>
<?php endwhile; // end of the loop. ?> <?php endwhile; // end of the loop. ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->
</div><!-- #main-content -->
<?php <?php
get_sidebar(); get_sidebar();

View File

@ -15,6 +15,13 @@
get_header(); ?> 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="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
@ -35,8 +42,9 @@ get_header(); ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php <?php
get_sidebar( 'content' );
get_sidebar(); get_sidebar();
get_footer(); get_footer();

View File

@ -13,6 +13,12 @@
get_header(); ?> 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="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
@ -30,8 +36,9 @@ get_header(); ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php <?php
get_sidebar( 'content' );
get_sidebar(); get_sidebar();
get_footer(); get_footer();

View File

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

View File

@ -9,25 +9,27 @@
get_header(); ?> get_header(); ?>
<div id="primary" class="content-area"> <div id="main-content" class="main-content">
<div id="content" class="site-content" role="main"> <div id="primary" class="content-area">
<?php <div id="content" class="site-content" role="main">
while ( have_posts() ) : <?php
the_post(); 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 are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) if ( comments_open() || get_comments_number() )
comments_template(); comments_template();
endwhile; endwhile;
?> ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php <?php
get_sidebar( 'content' );
get_sidebar(); get_sidebar();
get_footer(); 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. Use it to make something cool, have fun, and share what you've learned with others.
*/ */
/** /**
* Table of Contents: * 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.8 - Archives
* 6.9 - Contributor Page * 6.9 - Contributor Page
* 6.10 - 404 Page * 6.10 - 404 Page
* 6.11 - Front Page * 6.11 - Full-width
* 6.12 - Full-width * 6.12 - Comments
* 6.13 - Comments
* 7.0 - Sidebar * 7.0 - Sidebar
* 7.1 - Widgets * 7.1 - Widgets
* 7.2 - Content Sidebar Widgets * 7.2 - Content Sidebar Widgets
@ -770,6 +768,10 @@ span + .edit-link:before,
position: relative; position: relative;
} }
.main-content {
width: 100%;
}
/** /**
* 4.0 Header * 4.0 Header
@ -1721,17 +1723,7 @@ a.post-thumbnail:hover {
/** /**
* 6.11 Front Page * 6.11 Full-width
* -----------------------------------------------------------------------------
*/
.front-page-content-wrapper {
width: 100%;
}
/**
* 6.12 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; padding-left: 182px;
} }
.main-content {
float: left;
}
.site-content { .site-content {
margin: 0 29.04761904% 0 182px; margin: 0 29.04761904% 0 182px;
} }
@ -3377,10 +3373,6 @@ a.post-thumbnail:hover {
width: 25%; width: 25%;
} }
.front-page-content-wrapper {
float: left;
}
.featured-content { .featured-content {
padding-left: 182px; padding-left: 182px;
} }

View File

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

View File

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