Twenty Fifteen: doc cleanup, addresses removing periods from file header summaries, some spacing, loop documentation, and https instead of http.

Props DrewAPicture, MikeHansenMe, see #30149.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ian Stewart 2014-11-19 20:28:25 +00:00
parent ad646bc183
commit b7ede43c4f
20 changed files with 211 additions and 162 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying 404 pages (not found).
* The template for displaying 404 pages (not found)
*
* @package WordPress
* @subpackage Twenty_Fifteen

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying archive pages.
* The template for displaying archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
@ -10,7 +10,7 @@
* already has tag.php for Tag archives, category.php for Category archives,
* and author.php for Author archives.
*
* @link http://codex.wordpress.org/Template_Hierarchy
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -31,32 +31,33 @@ get_header(); ?>
?>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>
<?php endwhile; ?>
<?php
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
?>
// Start the Loop.
while ( have_posts() ) : the_post();
<?php else : ?>
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
<?php get_template_part( 'content', 'none' ); ?>
// End the loop.
endwhile;
<?php endif; ?>
// Previous/next page navigation.
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
// If no content, include the "No posts found" template.
else :
get_template_part( 'content', 'none' );
endif;
?>
</main><!-- .site-main -->
</section><!-- .content-area -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying Author bios.
* The template for displaying Author bios
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -20,16 +20,20 @@
* @param int $size The avatar height and width size in pixels.
*/
$author_bio_avatar_size = apply_filters( 'twentyfifteen_author_bio_avatar_size', 56 );
echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
?>
</div><!-- .author-avatar -->
<div class="author-description">
<h3 class="author-title"><?php echo get_the_author(); ?></h3>
<p class="author-bio">
<?php the_author_meta( 'description' ); ?>
<a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
<?php printf( __( 'View all posts by %s', 'twentyfifteen' ), get_the_author() ); ?>
</a>
</p><!-- .author-bio -->
</div><!-- .author-description -->
</div><!-- .author-info -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying comments.
* The template for displaying comments
*
* The area of the page that contains both current comments
* and the comment form.

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying link post formats.
* The template for displaying link post formats
*
* Used for both single and index/archive/search.
*
@ -45,6 +45,7 @@
<!-- .entry-content -->
<?php
// Author bio.
if ( is_single() && get_the_author_meta( 'description' ) ) :
get_template_part( 'author-bio' );
endif;
@ -55,4 +56,5 @@
<?php edit_post_link( esc_html__( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer>
<!-- .entry-footer -->
</article><!-- #post-## -->

View File

@ -1,8 +1,8 @@
<?php
/**
* The template part for displaying a message that posts cannot be found.
* The template part for displaying a message that posts cannot be found
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -16,6 +16,7 @@
</header><!-- .page-header -->
<div class="page-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentyfifteen' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
@ -31,5 +32,6 @@
<?php get_search_form(); ?>
<?php endif; ?>
</div><!-- .page-content -->
</section><!-- .no-results -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The template used for displaying page content.
* The template used for displaying page content
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -9,7 +9,10 @@
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php twentyfifteen_post_thumbnail(); ?>
<?php
// Post thumbnail.
twentyfifteen_post_thumbnail();
?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

View File

@ -1,8 +1,8 @@
<?php
/**
* The template part for displaying results in search pages.
* The template part for displaying results in search pages
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -22,11 +22,16 @@
</div><!-- .entry-summary -->
<?php if ( 'post' == get_post_type() ) : ?>
<footer class="entry-footer">
<?php twentyfifteen_entry_meta(); ?>
<?php edit_post_link( esc_html__( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
<?php else : ?>
<?php edit_post_link( esc_html__( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?>
<?php endif; ?>
</article><!-- #post-## -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The default template for displaying content.
* The default template for displaying content
*
* Used for both single and index/archive/search.
*
@ -11,7 +11,10 @@
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php twentyfifteen_post_thumbnail(); ?>
<?php
// Post thumbnail.
twentyfifteen_post_thumbnail();
?>
<header class="entry-header">
<?php
@ -43,6 +46,7 @@
</div><!-- .entry-content -->
<?php
// Author bio.
if ( is_single() && get_the_author_meta( 'description' ) ) :
get_template_part( 'author-bio' );
endif;
@ -52,4 +56,5 @@
<?php twentyfifteen_entry_meta(); ?>
<?php edit_post_link( esc_html__( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying the footer.
* The template for displaying the footer
*
* Contains the closing of the "site-content" div and all content after.
*
@ -22,9 +22,10 @@
*/
do_action( 'twentyfifteen_credits' );
?>
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyfifteen' ) ); ?>"><?php printf( esc_html__( 'Proudly powered by %s', 'twentyfifteen' ), 'WordPress' ); ?></a>
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentyfifteen' ) ); ?>"><?php printf( esc_html__( 'Proudly powered by %s', 'twentyfifteen' ), 'WordPress' ); ?></a>
</div><!-- .site-info -->
</footer><!-- .site-footer -->
</div><!-- .site -->
<?php wp_footer(); ?>

View File

@ -1,6 +1,6 @@
<?php
/**
* Twenty Fifteen functions and definitions.
* Twenty Fifteen functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
@ -11,14 +11,14 @@
* functions.php file. The child theme's functions.php file is included before
* the parent theme's file, so the child theme functions would be used.
*
* @link http://codex.wordpress.org/Theme_Development
* @link http://codex.wordpress.org/Child_Themes
* @link https://codex.wordpress.org/Theme_Development
* @link https://codex.wordpress.org/Child_Themes
*
* Functions that are not pluggable (not wrapped in function_exists()) are
* instead attached to a filter or action hook.
*
* For more information on hooks, actions, and filters,
* @link http://codex.wordpress.org/Plugin_API
* {@link https://codex.wordpress.org/Plugin_API}
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -75,7 +75,7 @@ function twentyfifteen_setup() {
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
* See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 825, 510, true );
@ -96,7 +96,8 @@ function twentyfifteen_setup() {
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
@ -125,7 +126,7 @@ add_action( 'after_setup_theme', 'twentyfifteen_setup' );
*
* @since Twenty Fifteen 1.0
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
* @link https://codex.wordpress.org/Function_Reference/register_sidebar
*/
function twentyfifteen_widgets_init() {
register_sidebar( array(

View File

@ -1,8 +1,8 @@
<?php
/**
* The header for our theme.
* The template for displaying the header
*
* Displays all of the <head> section and everything up until the "site-content" div.
* Displays all of the &lt;head&gt; section and everything up until the "site-content" div.
*
* @package WordPress
* @subpackage Twenty_Fifteen

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying all single posts and attachments.
* The template for displaying image attachments
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -12,9 +12,13 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links">
<div class="nav-previous"><?php previous_image_link( false, esc_html__( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, esc_html__( 'Next Image', 'twentyfifteen' ) ); ?></div>
@ -26,6 +30,7 @@ get_header(); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<div class="entry-attachment">
<?php
/**
@ -36,6 +41,7 @@ get_header(); ?>
* @param string $image_size Image size. Default 'large'.
*/
$image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' );
echo wp_get_attachment_image( get_the_ID(), $image_size );
?>
@ -44,6 +50,7 @@ get_header(); ?>
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php
@ -63,6 +70,7 @@ get_header(); ?>
<?php twentyfifteen_entry_meta(); ?>
<?php edit_post_link( esc_html__( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
<?php
@ -70,15 +78,15 @@ get_header(); ?>
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php
// Previous/next post navigation.
the_post_navigation( array(
'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ),
) );
?>
<?php endwhile; // end of the loop. ?>
// End the loop.
endwhile;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->

View File

@ -1,14 +1,13 @@
<?php
/**
* The main template file.
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* e.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @link http://codex.wordpress.org/Template_Hierarchy
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -28,31 +27,33 @@ get_header(); ?>
</header>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>
<?php endwhile; ?>
<?php
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
?>
// Start the loop.
while ( have_posts() ) : the_post();
<?php else : ?>
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
<?php get_template_part( 'content', 'none' ); ?>
// End the loop.
endwhile;
<?php endif; ?>
// Previous/next page navigation.
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
// If no content, include the "No posts found" template.
else :
get_template_part( 'content', 'none' );
endif;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying pages.
* The template for displaying pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages and that
@ -16,18 +16,21 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
<?php get_template_part( 'content', 'page' ); ?>
// Include the page content template.
get_template_part( 'content', 'page' );
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
<?php endwhile; // end of the loop. ?>
// End the loop.
endwhile;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->

View File

@ -4,7 +4,7 @@ Description: Adds support for languages written in a Right To Left (RTL) directi
It's easy, just a matter of overwriting all the horizontal positioning attributes
of your CSS stylesheet in a separate stylesheet file named rtl.css.
See http://codex.wordpress.org/Right_to_Left_Language_Support
See: https://codex.wordpress.org/Right_to_Left_Language_Support
*/
/**

View File

@ -18,33 +18,34 @@ get_header(); ?>
<h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'twentyfifteen' ), get_search_query() ); ?></h1>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post(); ?>
<?php
/**
/*
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'content', 'search' );
?>
<?php endwhile; ?>
// End the loop.
endwhile;
<?php
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
?>
// Previous/next page navigation.
the_pagination( array(
'prev_text' => __( 'Previous page', 'twentyfifteen' ),
'next_text' => __( 'Next page', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
) );
<?php else : ?>
// If no content, include the "No posts found" template.
else :
get_template_part( 'content', 'none' );
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
endif;
?>
</main><!-- .site-main -->
</section><!-- .content-area -->

View File

@ -1,6 +1,6 @@
<?php
/**
* The sidebar containing the main widget area.
* The sidebar containing the main widget area
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -9,34 +9,39 @@
if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) || is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="secondary">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav id="site-navigation" class="main-navigation" role="navigation">
<?php
wp_nav_menu( array(
'menu_class' => 'nav-menu',
'theme_location' => 'primary',
) );
?>
</nav><!-- .main-navigation -->
<nav id="site-navigation" class="main-navigation" role="navigation">
<?php
// Primary navigation menu.
wp_nav_menu( array(
'menu_class' => 'nav-menu',
'theme_location' => 'primary',
) );
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
<?php if ( has_nav_menu( 'social' ) ) : ?>
<nav id="social-navigation" class="social-navigation" role="navigation">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
) );
?>
</nav><!-- .social-navigation -->
<nav id="social-navigation" class="social-navigation" role="navigation">
<?php
// Social links navigation menu.
wp_nav_menu( array(
'theme_location' => 'social',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
) );
?>
</nav><!-- .social-navigation -->
<?php endif; ?>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="widget-area" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- .widget-area -->
<div id="widget-area" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- .widget-area -->
<?php endif; ?>
</div><!-- .secondary -->
<?php endif; ?>

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying all single posts and attachments.
* The template for displaying all single posts and attachments
*
* @package WordPress
* @subpackage Twenty_Fifteen
@ -12,25 +12,31 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
<?php get_template_part( 'content', get_post_format() ); ?>
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
<?php
the_post_navigation( array(
'next_text' => _x( '<span class="meta-nav">Next <span class="screen-reader-text">post:</span></span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen' ),
'prev_text' => _x( '<span class="meta-nav">Previous <span class="screen-reader-text">post:</span></span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen' )
) );
?>
// Previous/next post navigation.
the_post_navigation( array(
'next_text' => _x( '<span class="meta-nav">Next <span class="screen-reader-text">post:</span></span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen' ),
'prev_text' => _x( '<span class="meta-nav">Previous <span class="screen-reader-text">post:</span></span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen' )
) );
<?php endwhile; // end of the loop. ?>
// End the loop.
endwhile;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->

View File

@ -1,8 +1,8 @@
/*
Theme Name: Twenty Fifteen
Theme URI: http://wordpress.org/themes/twentyfifteen
Theme URI: https://wordpress.org/themes/twentyfifteen
Author: the WordPress team
Author URI: http://wordpress.org/
Author URI: https://wordpress.org/
Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer.
Version: 0.1
License: GNU General Public License v2 or later
@ -2593,10 +2593,11 @@ span > video {
* 15.0 Media Queries
*/
/* Does the same thing as <meta name="viewport" content="width=device-width">,
/*
* Does the same thing as <meta name="viewport" content="width=device-width">,
* but in the future W3C standard way. -ms- prefix is required for IE10+ to
* render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
* the meta tag. See http://core.trac.wordpress.org/ticket/25888.
* the meta tag. See https://core.trac.wordpress.org/ticket/25888.
*/
@-ms-viewport {
width: device-width;