Merge pull request #762 from fklein-lu/fix/coding-standards-issues

Update theme against WordPress Coding Standards.
This commit is contained in:
Philip Arthur Moore 2015-05-28 20:28:19 +07:00
commit 00e6610198
17 changed files with 59 additions and 32 deletions

View File

@ -25,7 +25,9 @@ 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 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.
*/

View File

@ -25,7 +25,7 @@ if ( post_password_required() ) {
<?php if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
printf( // WPCS: XSS OK
printf( // WPCS: XSS OK.
esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', '_s' ) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
@ -33,7 +33,7 @@ if ( post_password_required() ) {
?>
</h2>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2>
<div class="nav-links">
@ -43,7 +43,7 @@ if ( post_password_required() ) {
</div><!-- .nav-links -->
</nav><!-- #comment-nav-above -->
<?php endif; // check for comment navigation ?>
<?php endif; // Check for comment navigation. ?>
<ol class="comment-list">
<?php
@ -54,7 +54,7 @@ if ( post_password_required() ) {
?>
</ol><!-- .comment-list -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2>
<div class="nav-links">
@ -64,9 +64,9 @@ if ( post_password_required() ) {
</div><!-- .nav-links -->
</nav><!-- #comment-nav-below -->
<?php endif; // check for comment navigation ?>
<?php endif; // Check for comment navigation. ?>
<?php endif; // have_comments() ?>
<?php endif; // Check for have_comments(). ?>
<?php
// If comments are closed and there are comments, let's leave a little note, shall we?

View File

@ -6,6 +6,7 @@
*
* @package _s
*/
?>
</div><!-- #content -->

View File

@ -14,7 +14,6 @@ if ( ! function_exists( '_s_setup' ) ) :
* as indicating support for post thumbnails.
*/
function _s_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
@ -39,7 +38,7 @@ function _s_setup() {
*
* @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.
register_nav_menus( array(
@ -51,7 +50,11 @@ function _s_setup() {
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
@ -59,7 +62,11 @@ function _s_setup() {
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link',
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
@ -120,7 +127,7 @@ add_action( 'wp_enqueue_scripts', '_s_scripts' );
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.

View File

@ -6,6 +6,7 @@
*
* @package _s
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>

View File

@ -4,13 +4,12 @@
* http://codex.wordpress.org/Custom_Headers
*
* You can add an optional custom header image to header.php like so ...
*
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="">
</a>
<?php endif; // End header image check. ?>
*
* @package _s
*/
@ -46,7 +45,7 @@ function _s_header_style() {
$header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value.
if ( HEADER_TEXTCOLOR == $header_text_color ) {
return;
}
@ -64,7 +63,7 @@ function _s_header_style() {
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that
// If the user has set a custom color for the text use that.
else :
?>
.site-title a,
@ -124,4 +123,4 @@ function _s_admin_header_image() {
</div>
<?php
}
endif; // _s_admin_header_image
endif; // _s_admin_header_image

View File

@ -38,7 +38,7 @@ if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) :
global $page, $paged;
// Add the blog name
// Add the blog name.
$title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page.
@ -47,7 +47,7 @@ if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) :
$title .= " $sep $site_description";
}
// Add a page number if necessary:
// Add a page number if necessary.
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( esc_html__( 'Page %s', '_s' ), max( $paged, $page ) );
}

View File

@ -19,9 +19,12 @@ function _s_jetpack_setup() {
} // end function _s_jetpack_setup
add_action( 'after_setup_theme', '_s_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function _s_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', get_post_format() );
}
} // end function _s_infinite_scroll_render
} // end function _s_infinite_scroll_render

View File

@ -92,7 +92,7 @@ function _s_posted_on() {
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
}
endif;
@ -107,13 +107,13 @@ function _s_entry_footer() {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', '_s' ) );
if ( $categories_list && _s_categorized_blog() ) {
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', '_s' ) . '</span>', $categories_list ); // WPCS: XSS OK
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', '_s' ) . '</span>', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', '_s' ) );
if ( $tags_list ) {
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', '_s' ) . '</span>', $tags_list ); // WPCS: XSS OK
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', '_s' ) . '</span>', $tags_list ); // WPCS: XSS OK.
}
}
@ -189,7 +189,7 @@ function the_archive_title( $before = '', $after = '' ) {
$title = apply_filters( 'get_the_archive_title', $title );
if ( ! empty( $title ) ) {
echo $before . $title . $after; // WPCS: XSS OK
echo $before . $title . $after; // WPCS: XSS OK.
}
}
endif;
@ -216,7 +216,7 @@ function the_archive_description( $before = '', $after = '' ) {
*
* @param string $description Archive description to be displayed.
*/
echo $before . $description . $after; // WPCS: XSS OK
echo $before . $description . $after; // WPCS: XSS OK.
}
}
endif;

View File

@ -22,7 +22,9 @@ 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 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.
*/

View File

@ -20,13 +20,13 @@ get_header(); ?>
<?php get_template_part( 'template-parts/content', 'page' ); ?>
<?php
// 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() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->

View File

@ -17,13 +17,13 @@ get_header(); ?>
<?php the_post_navigation(); ?>
<?php
// 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() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->

View File

@ -6,6 +6,7 @@
*
* @package _s
*/
?>
<section class="no-results not-found">
@ -30,4 +31,4 @@
<?php endif; ?>
</div><!-- .page-content -->
</section><!-- .no-results -->
</section><!-- .no-results -->

View File

@ -4,6 +4,7 @@
*
* @package _s
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@ -25,3 +26,4 @@
<?php edit_post_link( esc_html__( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->

View File

@ -6,6 +6,7 @@
*
* @package _s
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@ -27,3 +28,4 @@
<?php _s_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->

View File

@ -1,7 +1,10 @@
<?php
/**
* Template part for displaying single posts.
*
* @package _s
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@ -27,3 +30,4 @@
<?php _s_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->

View File

@ -1,7 +1,10 @@
<?php
/**
* Template part for displaying posts.
*
* @package _s
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@ -35,4 +38,4 @@
<footer class="entry-footer">
<?php _s_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
</article><!-- #post-## -->