_s: Adhere to updated WordPress core code formatting.

* Update PHPDoc.
* Add periods to the end of comment sentences.
* Limit line length to 80 chars.
* Use C++-style PHP comments only for function and file documentation.
This commit is contained in:
obenland 2013-11-07 15:41:41 -04:00
parent a7ce5b6f47
commit 6f63a0b39a
5 changed files with 43 additions and 43 deletions

View File

@ -15,47 +15,39 @@ if ( ! function_exists( '_s_setup' ) ) :
/** /**
* Sets up theme defaults and registers support for various WordPress features. * Sets up theme defaults and registers support for various WordPress features.
* *
* Note that this function is hooked into the after_setup_theme hook, which runs * Note that this function is hooked into the after_setup_theme hook, which
* before the init hook. The init hook is too late for some features, such as indicating * runs before the init hook. The init hook is too late for some features, such
* support post thumbnails. * as indicating support for post thumbnails.
*/ */
function _s_setup() { function _s_setup() {
/** /*
* Make theme available for translation * Make theme available for translation.
* Translations can be filed in the /languages/ directory * Translations can be filed in the /languages/ directory.
* If you're building a theme based on _s, use a find and replace * If you're building a theme based on _s, use a find and replace
* to change '_s' to the name of your theme in all the template files * to change '_s' to the name of your theme in all the template files
*/ */
load_theme_textdomain( '_s', get_template_directory() . '/languages' ); load_theme_textdomain( '_s', get_template_directory() . '/languages' );
/** // Add default posts and comments RSS feed links to head.
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' ); add_theme_support( 'automatic-feed-links' );
/** /*
* Enable support for Post Thumbnails on posts and pages * Enable support for Post Thumbnails on posts and pages.
* *
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/ */
//add_theme_support( 'post-thumbnails' ); //add_theme_support( 'post-thumbnails' );
/** // This theme uses wp_nav_menu() in one location.
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array( register_nav_menus( array(
'primary' => __( 'Primary Menu', '_s' ), 'primary' => __( 'Primary Menu', '_s' ),
) ); ) );
/** // Enable support for Post Formats.
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
/** // Setup the WordPress core custom background feature.
* Setup the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( '_s_custom_background_args', array( add_theme_support( 'custom-background', apply_filters( '_s_custom_background_args', array(
'default-color' => 'ffffff', 'default-color' => 'ffffff',
'default-image' => '', 'default-image' => '',
@ -65,7 +57,7 @@ endif; // _s_setup
add_action( 'after_setup_theme', '_s_setup' ); add_action( 'after_setup_theme', '_s_setup' );
/** /**
* Register widgetized area and update sidebar with default widgets * Register widgetized area and update sidebar with default widgets.
*/ */
function _s_widgets_init() { function _s_widgets_init() {
register_sidebar( array( register_sidebar( array(
@ -80,7 +72,7 @@ function _s_widgets_init() {
add_action( 'widgets_init', '_s_widgets_init' ); add_action( 'widgets_init', '_s_widgets_init' );
/** /**
* Enqueue scripts and styles * Enqueue scripts and styles.
*/ */
function _s_scripts() { function _s_scripts() {
wp_enqueue_style( '_s-style', get_stylesheet_uri() ); wp_enqueue_style( '_s-style', get_stylesheet_uri() );
@ -89,14 +81,12 @@ function _s_scripts() {
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) { if ( is_singular() && wp_attachment_is_image() )
wp_enqueue_script( '_s-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); wp_enqueue_script( '_s-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
} }
}
add_action( 'wp_enqueue_scripts', '_s_scripts' ); add_action( 'wp_enqueue_scripts', '_s_scripts' );
/** /**

View File

@ -9,6 +9,9 @@
/** /**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*
* @param array $args Configuration arguments.
* @return array
*/ */
function _s_page_menu_args( $args ) { function _s_page_menu_args( $args ) {
$args['show_home'] = true; $args['show_home'] = true;
@ -18,19 +21,22 @@ add_filter( 'wp_page_menu_args', '_s_page_menu_args' );
/** /**
* Adds custom classes to the array of body classes. * Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/ */
function _s_body_classes( $classes ) { function _s_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author // Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) { if ( is_multi_author() )
$classes[] = 'group-blog'; $classes[] = 'group-blog';
}
return $classes; return $classes;
} }
add_filter( 'body_class', '_s_body_classes' ); add_filter( 'body_class', '_s_body_classes' );
/** /**
* Filter in a link to a content ID attribute for the next/previous image links on image attachment pages * Filter in a link to a content ID attribute for the next/previous image links
* on image attachment pages.
*/ */
function _s_enhanced_image_navigation( $url, $id ) { function _s_enhanced_image_navigation( $url, $id ) {
if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) if ( ! is_attachment() && ! wp_attachment_is_image( $id ) )
@ -46,6 +52,10 @@ add_filter( 'attachment_link', '_s_enhanced_image_navigation', 10, 2 );
/** /**
* Filters wp_title to print a neat <title> tag based on what is being viewed. * Filters wp_title to print a neat <title> tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/ */
function _s_wp_title( $title, $sep ) { function _s_wp_title( $title, $sep ) {
global $page, $paged; global $page, $paged;

View File

@ -2,14 +2,14 @@
/** /**
* Custom template tags for this theme. * Custom template tags for this theme.
* *
* Eventually, some of the functionality here could be replaced by core features * Eventually, some of the functionality here could be replaced by core features.
* *
* @package _s * @package _s
*/ */
if ( ! function_exists( '_s_content_nav' ) ) : if ( ! function_exists( '_s_content_nav' ) ) :
/** /**
* Display navigation to next/previous pages when applicable * Display navigation to next/previous pages when applicable.
*/ */
function _s_content_nav( $nav_id ) { function _s_content_nav( $nav_id ) {
global $wp_query, $post; global $wp_query, $post;
@ -124,7 +124,7 @@ function _s_the_attached_image() {
$attachment_size = apply_filters( '_s_attachment_size', array( 1200, 1200 ) ); $attachment_size = apply_filters( '_s_attachment_size', array( 1200, 1200 ) );
$next_attachment_url = wp_get_attachment_url(); $next_attachment_url = wp_get_attachment_url();
/** /*
* Grab the IDs of all the image attachments in a gallery so we can get the * Grab the IDs of all the image attachments in a gallery so we can get the
* URL of the next adjacent image in a gallery, or the first image (if * URL of the next adjacent image in a gallery, or the first image (if
* we're looking at the last image in a gallery), or, in a gallery of one, * we're looking at the last image in a gallery), or, in a gallery of one,
@ -196,32 +196,32 @@ function _s_posted_on() {
endif; endif;
/** /**
* Returns true if a blog has more than 1 category * Returns true if a blog has more than 1 category.
*/ */
function _s_categorized_blog() { function _s_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
// Create an array of all the categories that are attached to posts // Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array( $all_the_cool_cats = get_categories( array(
'hide_empty' => 1, 'hide_empty' => 1,
) ); ) );
// Count the number of categories that are attached to the posts // Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats ); $all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'all_the_cool_cats', $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats );
} }
if ( '1' != $all_the_cool_cats ) { if ( '1' != $all_the_cool_cats ) {
// This blog has more than 1 category so _s_categorized_blog should return true // This blog has more than 1 category so _s_categorized_blog should return true.
return true; return true;
} else { } else {
// This blog has only 1 category so _s_categorized_blog should return false // This blog has only 1 category so _s_categorized_blog should return false.
return false; return false;
} }
} }
/** /**
* Flush out the transients used in _s_categorized_blog * Flush out the transients used in _s_categorized_blog.
*/ */
function _s_category_transient_flusher() { function _s_category_transient_flusher() {
// Like, beat it. Dig? // Like, beat it. Dig?

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* WordPress.com-specific functions and definitions * WordPress.com-specific functions and definitions.
* *
* @package _s * @package _s
*/ */

View File

@ -1,10 +1,10 @@
/* /*
Theme Name: _s Theme Name: _s
Theme URI: http://underscores.me Theme URI: http://underscores.me/
Author: Automattic Author: Automattic
Author URI: http://automattic.com/ Author URI: http://automattic.com/
Description: Hi. I'm a starter theme called <code>_s</code>, or <em>underscores</em>, if you like. I'm a theme meant for hacking so don't use me as a <em>Parent Theme</em>. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for. Description: Hi. I'm a starter theme called <code>_s</code>, or <em>underscores</em>, if you like. I'm a theme meant for hacking so don't use me as a <em>Parent Theme</em>. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for.
Version: 1.3-wpcom Version: 1.0-wpcom
License: GNU General Public License v2 or later License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: _s Text Domain: _s