Twenty Eleven: update code comments to reflect WP inline docs standards. Props DrewAPicture, see #25256.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-09-25 16:50:11 +00:00
parent 881c87cc51
commit 25d1363a66
32 changed files with 350 additions and 125 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying 404 pages (Not Found).
* Template for displaying 404 pages (Not Found)
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,11 +1,11 @@
<?php
/**
* The template for displaying Archive pages.
* 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.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying Author Archive pages.
* Template for displaying Author Archive pages
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -15,11 +15,12 @@ get_header(); ?>
<?php if ( have_posts() ) : ?>
<?php
/* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
/**
* Queue the first post, that way we know what author
* we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
* We reset this later so we can run the loop properly
* with a call to rewind_posts().
*/
the_post();
?>
@ -29,7 +30,8 @@ get_header(); ?>
</header>
<?php
/* Since we called the_post() above, we need to
/**
* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
@ -43,7 +45,16 @@ get_header(); ?>
if ( get_the_author_meta( 'description' ) ) : ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 60 ) ); ?>
<?php
/**
* Filter the Twenty Eleven author bio avatar size.
*
* @since Twenty Eleven 1.0
*
* @param int The height and width avatar dimension in pixels. Default 60.
*/
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 60 ) );
?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
@ -56,7 +67,8 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
/**
* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying Category Archive pages.
* Template for displaying Category Archive pages
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -21,8 +21,16 @@ get_header(); ?>
<?php
$category_description = category_description();
if ( ! empty( $category_description ) )
if ( ! empty( $category_description ) ) {
/**
* Filter the default Twenty Eleven category description.
*
* @since Twenty Eleven 1.0
*
* @param string The default category description HTML.
*/
echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
}
?>
</header>
@ -32,7 +40,8 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
/**
* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying Comments.
* Template for displaying Comments
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
@ -17,7 +17,8 @@
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></p>
</div><!-- #comments -->
<?php
/* Stop the rest of comments.php from being processed,
/**
* Stop the rest of comments.php from being processed,
* but don't kill the script entirely -- we still have
* to fully load the template.
*/
@ -45,7 +46,8 @@
<ol class="commentlist">
<?php
/* Loop through and list the comments. Tell wp_list_comments()
/**
* Loop through and list the comments. Tell wp_list_comments()
* to use twentyeleven_comment() to format the comments.
* If you want to overload this in a child theme then you can
* define twentyeleven_comment() and that will be used instead.
@ -64,7 +66,8 @@
<?php endif; // check for comment navigation ?>
<?php
/* If there are no comments and comments are closed, let's leave a little note, shall we?
/**
* If there are no comments and comments are closed, let's leave a little note, shall we?
* But we only want the note on posts and pages that had comments in the first place.
*/
if ( ! comments_open() && get_comments_number() ) : ?>

View File

@ -1,8 +1,10 @@
<?php
/**
* The template for displaying posts in the Aside Post Format on index and archive pages
* Template for displaying posts in the Aside Post Format
*
* Learn more: http://codex.wordpress.org/Post_Formats
* Used on index and archive pages.
*
* @link http://codex.wordpress.org/Post_Formats
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying content featured in the showcase.php page template
* Template for displaying content featured in the showcase.php page template
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,8 +1,10 @@
<?php
/**
* The template for displaying posts in the Gallery Post Format on index and archive pages
* Template for displaying posts in the Gallery Post Format
*
* Learn more: http://codex.wordpress.org/Post_Formats
* Used on index and archive pages.
*
* @link http://codex.wordpress.org/Post_Formats
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,8 +1,10 @@
<?php
/**
* The template for displaying posts in the Image Post Format on index and archive pages
* Template for displaying posts in the Image Post Format
*
* Learn more: http://codex.wordpress.org/Post_Formats
* Used on index and archive pages.
*
* @link http://codex.wordpress.org/Post_Formats
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying page content in the showcase.php page template
* Template for displaying page content in the showcase.php page template
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,8 +1,10 @@
<?php
/**
* The template for displaying posts in the Link Post Format on index and archive pages
* Template for displaying posts in the Link Post Format
*
* Learn more: http://codex.wordpress.org/Post_Formats
* Used on index and archive pages
*
* @link http://codex.wordpress.org/Post_Formats
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template used for displaying page content in page.php
* Template used for displaying page content in page.php
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The default template for displaying content
* Template for displaying content
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -54,7 +54,10 @@
<?php if ( get_the_author_meta( 'description' ) && ( ! function_exists( 'is_multi_author' ) || is_multi_author() ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); ?>
<?php
//duplicate_hook
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) );
?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>

View File

@ -1,11 +1,14 @@
<?php
/**
* The template for displaying posts in the Status Post Format on index and archive pages
* Template for displaying posts in the Status Post Format
*
* Learn more: http://codex.wordpress.org/Post_Formats
* Used on index and archive pages
*
* @link http://codex.wordpress.org/Post_Formats
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
?>
@ -29,7 +32,18 @@
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'twentyeleven_status_avatar', '65' ) ); ?></div>
<div class="avatar">
<?php
/**
* Filter the Twenty Eleven status avatar size.
*
* @since Twenty Eleven 1.0
*
* @param int The height and width avatar dimensions in pixels. Default 65.
*/
echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'twentyeleven_status_avatar', 65 ) );
?>
</div>
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>

View File

@ -1,6 +1,6 @@
<?php
/**
* The default template for displaying content
* Template for displaying content
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying the footer.
* Template for displaying the footer
*
* Contains the closing of the id=main div and all content after
*
@ -15,7 +15,8 @@
<footer id="colophon" role="contentinfo">
<?php
/* A sidebar in the footer? Yep. You can can customize
/**
* A sidebar in the footer? Yep. You can can customize
* your footer with three columns of widgets.
*/
if ( ! is_404() )

View File

@ -51,7 +51,7 @@ add_action( 'after_setup_theme', 'twentyeleven_setup' );
if ( ! function_exists( 'twentyeleven_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
* Set up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
@ -60,22 +60,24 @@ if ( ! function_exists( 'twentyeleven_setup' ) ):
* To override twentyeleven_setup() in a child theme, add your own twentyeleven_setup to your child theme's
* functions.php file.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
* and backgrounds, and post formats.
* @uses register_nav_menus() To add support for navigation menus.
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
* and backgrounds, and post formats.
* @uses register_nav_menus() To add support for navigation menus.
* @uses register_default_headers() To register the default custom header images provided with the theme.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Twenty Eleven 1.0
*/
function twentyeleven_setup() {
/* Make Twenty Eleven available for translation.
/**
* Make Twenty Eleven available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Twenty Eleven, use a find and replace
* to change 'twentyeleven' to the name of your theme in all the template files.
* If you're building a theme based on Twenty Eleven, use
* a find and replace to change 'twentyeleven' to the name
* of your theme in all the template files.
*/
load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
@ -105,8 +107,10 @@ function twentyeleven_setup() {
// Add support for custom backgrounds.
add_theme_support( 'custom-background', array(
// Let WordPress know what our default background color is.
// This is dependent on our current color scheme.
/**
* Let WordPress know what our default background color is.
* This is dependent on our current color scheme.
*/
'default-color' => $default_background_color,
) );
@ -118,7 +122,21 @@ function twentyeleven_setup() {
// The default header text color.
'default-text-color' => '000',
// The height and width of our custom header.
/**
* Filter the Twenty Eleven default header image width.
*
* @since Twenty Eleven 1.0
*
* @param int The default header image width in pixels. Default 1000.
*/
'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ),
/**
* Filter the Twenty Eleven default header image height.
*
* @since Twenty Eleven 1.0
*
* @param int The default header image height in pixels. Default 288.
*/
'height' => apply_filters( 'twentyeleven_header_image_height', 288 ),
// Support flexible heights.
'flex-height' => true,
@ -144,13 +162,17 @@ function twentyeleven_setup() {
add_custom_background();
}
// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be the size of the header image that we just defined
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
/**
* We'll be using post thumbnails for custom header images on posts and pages.
* We want them to be the size of the header image that we just defined.
* Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
*/
set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true );
// Add Twenty Eleven's custom image sizes.
// Used for large feature (header) images.
/**
* Add Twenty Eleven's custom image sizes.
* Used for large feature (header) images.
*/
add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true );
// Used for featured posts if a large-feature doesn't exist.
add_image_size( 'small-feature', 500, 300 );
@ -211,7 +233,7 @@ endif; // twentyeleven_setup
if ( ! function_exists( 'twentyeleven_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
* Styles the header image and text displayed on the blog.
*
* @since Twenty Eleven 1.0
*/
@ -327,10 +349,16 @@ function twentyeleven_admin_header_image() { ?>
endif; // twentyeleven_admin_header_image
/**
* Sets the post excerpt length to 40 words.
* Set the post excerpt length to 40 words.
*
* To override this length in a child theme, remove the filter and add your own
* function tied to the excerpt_length filter hook.
* To override this length in a child theme, remove
* the filter and add your own function tied to
* the excerpt_length filter hook.
*
* @since Twenty Eleven 1.0
*
* @param int $length The number of excerpt characters.
* @return int The filtered number of characters.
*/
function twentyeleven_excerpt_length( $length ) {
return 40;
@ -339,7 +367,11 @@ add_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
if ( ! function_exists( 'twentyeleven_continue_reading_link' ) ) :
/**
* Returns a "Continue Reading" link for excerpts
* Return a "Continue Reading" link for excerpts
*
* @since Twenty Eleven 1.0
*
* @return string The "Continue Reading" HTML link.
*/
function twentyeleven_continue_reading_link() {
return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
@ -347,10 +379,17 @@ function twentyeleven_continue_reading_link() {
endif; // twentyeleven_continue_reading_link
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link().
* Replace "[...]" in the Read More link with an ellipsis.
*
* The "[...]" is appended to automatically generated excerpts.
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
*
* @since Twenty Eleven 1.0
*
* @param string $more The Read More text.
* @return The filtered Read More text.
*/
function twentyeleven_auto_excerpt_more( $more ) {
return ' &hellip;' . twentyeleven_continue_reading_link();
@ -358,10 +397,15 @@ function twentyeleven_auto_excerpt_more( $more ) {
add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
* Add a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*
* @since Twenty Eleven 1.0
*
* @param string $output The "Continue Reading" link.
* @return string The filtered "Continue Reading" link.
*/
function twentyeleven_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
@ -372,7 +416,12 @@ function twentyeleven_custom_excerpt_more( $output ) {
add_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
* Show a home link for the wp_nav_menu() fallback, wp_page_menu().
*
* @since Twenty Eleven 1.0
*
* @param array $args The page menu arguments. @see wp_page_menu()
* @return array The filtered page menu arguments.
*/
function twentyeleven_page_menu_args( $args ) {
if ( ! isset( $args['show_home'] ) )
@ -382,7 +431,9 @@ function twentyeleven_page_menu_args( $args ) {
add_filter( 'wp_page_menu_args', 'twentyeleven_page_menu_args' );
/**
* Register our sidebars and widgetized areas. Also register the default Epherma widget.
* Register sidebars and widgetized areas.
*
* Also register the default Epherma widget.
*
* @since Twenty Eleven 1.0
*/
@ -443,7 +494,11 @@ add_action( 'widgets_init', 'twentyeleven_widgets_init' );
if ( ! function_exists( 'twentyeleven_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
* Display navigation to next/previous pages when applicable.
*
* @since Twenty Eleven 1.0
*
* @param string $html_id The HTML id attribute.
*/
function twentyeleven_content_nav( $html_id ) {
global $wp_query;
@ -462,9 +517,11 @@ endif; // twentyeleven_content_nav
* Return the first link from the post content. If none found, the
* post permalink is used as a fallback.
*
* @since Twenty Eleven 1.0
*
* @uses get_url_in_content() to get the first URL from the post content.
*
* @return string
* @return string The first link.
*/
function twentyeleven_get_first_url() {
$content = get_the_content();
@ -473,6 +530,7 @@ function twentyeleven_get_first_url() {
if ( ! $has_url )
$has_url = twentyeleven_url_grabber();
//duplicate_hook
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
}
@ -480,6 +538,7 @@ function twentyeleven_get_first_url() {
* Return the URL for the first link found in the post content.
*
* @since Twenty Eleven 1.0
*
* @return string|bool URL or false when no link is present.
*/
function twentyeleven_url_grabber() {
@ -490,7 +549,9 @@ function twentyeleven_url_grabber() {
}
/**
* Count the number of footer sidebars to enable dynamic classes for the footer
* Count the number of footer sidebars to enable dynamic classes for the footer.
*
* @since Twenty Eleven 1.0
*/
function twentyeleven_footer_sidebar_class() {
$count = 0;
@ -532,6 +593,10 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Twenty Eleven 1.0
*
* @param object $comment The comment object.
* @param array $args An array of comment arguments. @see get_comment_reply_link()
* @param int $depth The depth of the comment.
*/
function twentyeleven_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
@ -593,7 +658,8 @@ endif; // ends check for twentyeleven_comment()
if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
* Print HTML with meta information for the current post-date/time and author.
*
* Create your own twentyeleven_posted_on to override in a child theme
*
* @since Twenty Eleven 1.0
@ -612,11 +678,15 @@ function twentyeleven_posted_on() {
endif;
/**
* Adds two classes to the array of body classes.
* Add two classes to the array of body classes.
*
* The first is if the site has only had one author with published posts.
* The second is if a singular post being displayed
*
* @since Twenty Eleven 1.0
*
* @param array $classes Existing body classes.
* @return array The filtered array of body classes.
*/
function twentyeleven_body_classes( $classes ) {
@ -631,10 +701,10 @@ function twentyeleven_body_classes( $classes ) {
add_filter( 'body_class', 'twentyeleven_body_classes' );
/**
* Retrieves the IDs for images in a gallery.
* Retrieve the IDs for images in a gallery.
*
* @uses get_post_galleries() first, if available. Falls back to shortcode parsing,
* then as last option uses a get_posts() call.
* @uses get_post_galleries() First, if available. Falls back to shortcode parsing,
* then as last option uses a get_posts() call.
*
* @since Twenty Eleven 1.6.
*

View File

@ -1,8 +1,8 @@
<?php
/**
* The Header for our theme.
* Header template for the theme
*
* Displays all of the <head> section and everything up till <div id="main">
* Displays all of the <head> section and everything up till <div id="main">.
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -25,7 +25,7 @@
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php
/*
/**
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;
@ -52,13 +52,15 @@
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php
/* We add some JavaScript to pages with the comment form
/**
* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
/**
* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
@ -81,8 +83,10 @@
if ( $header_image ) :
// Compatibility with versions of WordPress prior to 3.4.
if ( function_exists( 'get_custom_header' ) ) {
// We need to figure out what the minimum width should be for our featured image.
// This result would be the suggested width if the theme were to implement flexible widths.
/**
* We need to figure out what the minimum width should be for our featured image.
* This result would be the suggested width if the theme were to implement flexible widths.
*/
$header_image_width = get_theme_support( 'custom-header', 'width' );
} else {
$header_image_width = HEADER_IMAGE_WIDTH;
@ -90,8 +94,10 @@
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
// The header image
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
/**
* The header image.
* Check if this is a post or page, if it has a thumbnail, and if it's a big one
*/
if ( is_singular() && has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
$image[1] >= $header_image_width ) :

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying image attachments.
* Template for displaying image attachments
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -72,6 +72,13 @@ get_header(); ?>
}
?>
<a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
/**
* Filter the Twenty Eleven default attachment size.
*
* @since Twenty Eleven 1.0
*
* @param int The height and width attachment size dimensions in pixels. Default 848.
*/
$attachment_size = apply_filters( 'twentyeleven_attachment_size', 848 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
?></a>

View File

@ -14,6 +14,7 @@
*
* @since Twenty Eleven 1.0
*
* @param string $hook_suffix An admin page's hook suffix.
*/
function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
@ -51,11 +52,11 @@ function twentyeleven_theme_options_init() {
// Register our individual settings fields
add_settings_field(
'color_scheme', // Unique identifier for the field for this section
__( 'Color Scheme', 'twentyeleven' ), // Setting field label
'color_scheme', // Unique identifier for the field for this section
__( 'Color Scheme', 'twentyeleven' ), // Setting field label
'twentyeleven_settings_field_color_scheme', // Function that renders the settings field
'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
'general' // Settings section. Same as the first argument in the add_settings_section() above
'theme_options', // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
'general' // Settings section. Same as the first argument in the add_settings_section() above
);
add_settings_field( 'link_color', __( 'Link Color', 'twentyeleven' ), 'twentyeleven_settings_field_link_color', 'theme_options', 'general' );
@ -66,7 +67,7 @@ add_action( 'admin_init', 'twentyeleven_theme_options_init' );
/**
* Change the capability required to save the 'twentyeleven_options' options group.
*
* @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.
* @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.
* @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
*
* By default, the options groups for all registered settings require the manage_options capability.
@ -83,7 +84,7 @@ function twentyeleven_option_page_capability( $capability ) {
add_filter( 'option_page_capability_twentyeleven_options', 'twentyeleven_option_page_capability' );
/**
* Add our theme options page to the admin menu, including some help documentation.
* Add a theme options page to the admin menu, including some help documentation.
*
* This function is attached to the admin_menu action hook.
*
@ -122,7 +123,7 @@ function twentyeleven_theme_options_help() {
$screen = get_current_screen();
if ( method_exists( $screen, 'add_help_tab' ) ) {
// WordPress 3.3
// WordPress 3.3.0
$screen->add_help_tab( array(
'title' => __( 'Overview', 'twentyeleven' ),
'id' => 'theme-options-help',
@ -132,13 +133,13 @@ function twentyeleven_theme_options_help() {
$screen->set_help_sidebar( $sidebar );
} else {
// WordPress 3.2
// WordPress 3.2.0
add_contextual_help( $screen, $help . $sidebar );
}
}
/**
* Returns an array of color schemes registered for Twenty Eleven.
* Return an array of color schemes registered for Twenty Eleven.
*
* @since Twenty Eleven 1.0
*/
@ -158,11 +159,18 @@ function twentyeleven_color_schemes() {
),
);
/**
* Filter the Twenty Eleven color scheme options.
*
* @since Twenty Eleven 1.0
*
* @param array $color_scheme_options An associative array of color scheme options.
*/
return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options );
}
/**
* Returns an array of layout options registered for Twenty Eleven.
* Return an array of layout options registered for Twenty Eleven.
*
* @since Twenty Eleven 1.0
*/
@ -185,13 +193,22 @@ function twentyeleven_layouts() {
),
);
/**
* Filter the Twenty Eleven layout options.
*
* @since Twenty Eleven 1.0
*
* @param array $layout_options An associative array of layout options.
*/
return apply_filters( 'twentyeleven_layouts', $layout_options );
}
/**
* Returns the default options for Twenty Eleven.
* Return the default options for Twenty Eleven.
*
* @since Twenty Eleven 1.0
*
* @return array An array of default theme options.
*/
function twentyeleven_get_default_theme_options() {
$default_theme_options = array(
@ -203,16 +220,24 @@ function twentyeleven_get_default_theme_options() {
if ( is_rtl() )
$default_theme_options['theme_layout'] = 'sidebar-content';
/**
* Filter the Twenty Eleven default options.
*
* @since Twenty Eleven 1.0
*
* @param array $default_theme_options An array of default theme options.
*/
return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options );
}
/**
* Returns the default link color for Twenty Eleven, based on color scheme.
* Return the default link color for Twenty Eleven, based on color scheme.
*
* @since Twenty Eleven 1.0
*
* @param $string $color_scheme Color scheme. Defaults to the active color scheme.
* @return $string Color.
* @param string $color_scheme Optional. Color scheme.
* Default null (or the active color scheme).
* @return string The default link color.
*/
function twentyeleven_get_default_link_color( $color_scheme = null ) {
if ( null === $color_scheme ) {
@ -228,7 +253,7 @@ function twentyeleven_get_default_link_color( $color_scheme = null ) {
}
/**
* Returns the options array for Twenty Eleven.
* Return the options array for Twenty Eleven.
*
* @since Twenty Eleven 1.0
*/
@ -237,7 +262,7 @@ function twentyeleven_get_theme_options() {
}
/**
* Renders the Color Scheme setting field.
* Render the Color Scheme setting field.
*
* @since Twenty Eleven 1.3
*/
@ -261,7 +286,7 @@ function twentyeleven_settings_field_color_scheme() {
}
/**
* Renders the Link Color setting field.
* Render the Link Color setting field.
*
* @since Twenty Eleven 1.3
*/
@ -278,7 +303,7 @@ function twentyeleven_settings_field_link_color() {
}
/**
* Renders the Layout setting field.
* Render the Layout setting field.
*
* @since Twenty Eleven 1.3
*/
@ -300,7 +325,7 @@ function twentyeleven_settings_field_layout() {
}
/**
* Returns the options array for Twenty Eleven.
* Return the options array for Twenty Eleven.
*
* @since Twenty Eleven 1.2
*/
@ -324,12 +349,16 @@ function twentyeleven_theme_options_render_page() {
}
/**
* Sanitize and validate form input. Accepts an array, return a sanitized array.
* Sanitize and validate form input.
*
* Accepts an array, return a sanitized array.
*
* @see twentyeleven_theme_options_init()
* @todo set up Reset Options action
*
* @since Twenty Eleven 1.0
*
* @param array $input An array of form input.
*/
function twentyeleven_theme_options_validate( $input ) {
$output = $defaults = twentyeleven_get_default_theme_options();
@ -349,6 +378,15 @@ function twentyeleven_theme_options_validate( $input ) {
if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) )
$output['theme_layout'] = $input['theme_layout'];
/**
* Filter the Twenty Eleven sanitized form input array.
*
* @since Twenty Eleven 1.0
*
* @param array $output An array of sanitized form output.
* @param array $input An array of un-sanitized form input.
* @param array $defaults An array of default theme options.
*/
return apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults );
}
@ -364,6 +402,13 @@ function twentyeleven_enqueue_color_scheme() {
if ( 'dark' == $color_scheme )
wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
/**
* Fires after the styles for the Twenty Eleven color scheme are enqueued.
*
* @since Twenty Eleven 1.0
*
* @param string $color_scheme The color scheme.
*/
do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
}
add_action( 'wp_enqueue_scripts', 'twentyeleven_enqueue_color_scheme' );
@ -417,9 +462,11 @@ function twentyeleven_print_link_color_style() {
add_action( 'wp_head', 'twentyeleven_print_link_color_style' );
/**
* Adds Twenty Eleven layout classes to the array of body classes.
* Add Twenty Eleven layout classes to the array of body classes.
*
* @since Twenty Eleven 1.0
*
* @param array $existing_classes An array of existing body classes.
*/
function twentyeleven_layout_classes( $existing_classes ) {
$options = twentyeleven_get_theme_options();
@ -437,6 +484,14 @@ function twentyeleven_layout_classes( $existing_classes ) {
else
$classes[] = $current_layout;
/**
* Filter the Twenty Eleven layout body classes.
*
* @since Twenty Eleven 1.0
*
* @param array $classes An array of body classes.
* @param string $current_layout The current theme layout.
*/
$classes = apply_filters( 'twentyeleven_layout_classes', $classes, $current_layout );
return array_merge( $existing_classes, $classes );
@ -446,10 +501,11 @@ add_filter( 'body_class', 'twentyeleven_layout_classes' );
/**
* Implements Twenty Eleven theme options into Theme Customizer
*
* @param $wp_customize Theme Customizer object
* @since Twenty Eleven 1.3
*
* @param object $wp_customize Theme Customizer object.
* @return void
*
* @since Twenty Eleven 1.3
*/
function twentyeleven_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
@ -521,6 +577,7 @@ add_action( 'customize_register', 'twentyeleven_customize_register' );
/**
* Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
*
* Used with blogname and blogdescription.
*
* @since Twenty Eleven 1.3

View File

@ -1,8 +1,10 @@
<?php
/**
* Makes a custom Widget for displaying Aside, Link, Status, and Quote Posts available with Twenty Eleven
* Widget For displaying post format posts
*
* Learn more: http://codex.wordpress.org/Widgets_API#Developing_Widgets
* Handles displaying Aside, Link, Status, and Quote Posts available with Twenty Eleven.
*
* @link http://codex.wordpress.org/Widgets_API#Developing_Widgets
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -13,6 +15,8 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
/**
* Constructor
*
* @since Twenty Eleven 1.0
*
* @return void
**/
function Twenty_Eleven_Ephemera_Widget() {
@ -28,9 +32,11 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
/**
* Outputs the HTML for this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void Echoes its output
* @since Twenty Eleven 1.0
*
* @param array $args An array of standard parameters for widgets in this theme.
* @param array $instance An array of settings for this widget instance.
* @return void
**/
function widget( $args, $instance ) {
$cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
@ -49,6 +55,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
ob_start();
extract( $args, EXTR_SKIP );
//duplicate_hook
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base);
if ( ! isset( $instance['number'] ) )
@ -120,8 +127,12 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
}
/**
* Update widget settings.
*
* Deals with the settings when they are saved by the admin. Here is
* where any validation should be dealt with.
*
* @since Twenty Eleven 1.0
**/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
@ -136,12 +147,21 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
return $instance;
}
/**
* Flush widget cache.
*
* @since Twenty Eleven 1.0
*/
function flush_widget_cache() {
wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
}
/**
* Set up the widget form.
*
* Displays the form for this widget on the Widgets page of the WP Admin area.
*
* @since Twenty Eleven 1.0
**/
function form( $instance ) {
$title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';

View File

@ -1,6 +1,6 @@
<?php
/**
* The main template file.
* 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).

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying all pages.
* Template for displaying all pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying Search Results pages.
* Template for displaying Search Results pages
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -24,9 +24,11 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
/**
* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
* called content-___.php (where ___ is the Post Format name) and that
* will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying search forms in Twenty Eleven
* Template for displaying search forms in Twenty Eleven
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,7 +1,8 @@
<?php
/**
* Template Name: Showcase Template
* Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts
*
* Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts.
*
* The showcase template in Twenty Eleven consists of a featured posts section using sticky posts,
* another recent posts area (with the latest post shown in full and the rest as a list)

View File

@ -1,6 +1,6 @@
<?php
/**
* The Footer widget areas.
* Footer widget areas
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -9,7 +9,8 @@
?>
<?php
/* The footer widget area is triggered if any of the areas
/**
* The footer widget area is triggered if any of the areas
* have widgets. So let's check that first.
*
* If none of the sidebars have widgets, then let's bail early.

View File

@ -1,7 +1,8 @@
<?php
/**
* Template Name: Sidebar Template
* Description: A Page Template that adds a sidebar to pages
*
* Description: A Page Template that adds a sidebar to pages.
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The Sidebar containing the main widget area.
* Sidebar containing the main widget area
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The Template for displaying all single posts.
* Template for displaying all single posts
*
* @package WordPress
* @subpackage Twenty_Eleven

View File

@ -1,6 +1,6 @@
<?php
/**
* The template used to display Tag Archive pages
* Template used to display Tag Archive pages
*
* @package WordPress
* @subpackage Twenty_Eleven
@ -21,8 +21,16 @@ get_header(); ?>
<?php
$tag_description = tag_description();
if ( ! empty( $tag_description ) )
if ( ! empty( $tag_description ) ) {
/**
* Filter the default Twenty Eleven tag description.
*
* @since Twenty Eleven 1.0
*
* @param string The default tag description.
*/
echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
}
?>
</header>
@ -32,9 +40,11 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
/**
* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
* called content-___.php (where ___ is the Post Format name) and that
* will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>