Fix Codesniffer errors.

This commit is contained in:
Fränk Klein 2015-05-27 19:49:01 +02:00
parent b215eebe1e
commit 175524922c
17 changed files with 59 additions and 32 deletions

View File

@ -25,7 +25,9 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>
<?php <?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 * 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. * 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() ) : ?> <?php if ( have_comments() ) : ?>
<h2 class="comments-title"> <h2 class="comments-title">
<?php <?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' ) ), 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() ), number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>' '<span>' . get_the_title() . '</span>'
@ -33,7 +33,7 @@ if ( post_password_required() ) {
?> ?>
</h2> </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"> <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2> <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2>
<div class="nav-links"> <div class="nav-links">
@ -43,7 +43,7 @@ if ( post_password_required() ) {
</div><!-- .nav-links --> </div><!-- .nav-links -->
</nav><!-- #comment-nav-above --> </nav><!-- #comment-nav-above -->
<?php endif; // check for comment navigation ?> <?php endif; // Check for comment navigation. ?>
<ol class="comment-list"> <ol class="comment-list">
<?php <?php
@ -54,7 +54,7 @@ if ( post_password_required() ) {
?> ?>
</ol><!-- .comment-list --> </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"> <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2> <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', '_s' ); ?></h2>
<div class="nav-links"> <div class="nav-links">
@ -64,9 +64,9 @@ if ( post_password_required() ) {
</div><!-- .nav-links --> </div><!-- .nav-links -->
</nav><!-- #comment-nav-below --> </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 <?php
// If comments are closed and there are comments, let's leave a little note, shall we? // If comments are closed and there are comments, let's leave a little note, shall we?

View File

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

View File

@ -14,7 +14,6 @@ if ( ! function_exists( '_s_setup' ) ) :
* as indicating support for 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.
@ -39,7 +38,7 @@ function _s_setup() {
* *
* @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(
@ -51,7 +50,11 @@ function _s_setup() {
* to output valid HTML5. * to output valid HTML5.
*/ */
add_theme_support( 'html5', array( 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 * See http://codex.wordpress.org/Post_Formats
*/ */
add_theme_support( 'post-formats', array( add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'aside',
'image',
'video',
'quote',
'link',
) ); ) );
// Set up the WordPress core custom background feature. // Set up the WordPress core custom background feature.
@ -120,7 +127,7 @@ add_action( 'wp_enqueue_scripts', '_s_scripts' );
/** /**
* Implement the Custom Header feature. * 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. * Custom template tags for this theme.

View File

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

View File

@ -4,13 +4,12 @@
* http://codex.wordpress.org/Custom_Headers * http://codex.wordpress.org/Custom_Headers
* *
* You can add an optional custom header image to header.php like so ... * You can add an optional custom header image to header.php like so ...
*
<?php if ( get_header_image() ) : ?> <?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> <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=""> <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> </a>
<?php endif; // End header image check. ?> <?php endif; // End header image check. ?>
* *
* @package _s * @package _s
*/ */
@ -46,7 +45,7 @@ function _s_header_style() {
$header_text_color = get_header_textcolor(); $header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail // 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 ) { if ( HEADER_TEXTCOLOR == $header_text_color ) {
return; return;
} }
@ -64,7 +63,7 @@ function _s_header_style() {
clip: rect(1px, 1px, 1px, 1px); clip: rect(1px, 1px, 1px, 1px);
} }
<?php <?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 : else :
?> ?>
.site-title a, .site-title a,
@ -124,4 +123,4 @@ function _s_admin_header_image() {
</div> </div>
<?php <?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; global $page, $paged;
// Add the blog name // Add the blog name.
$title .= get_bloginfo( 'name', 'display' ); $title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page. // 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"; $title .= " $sep $site_description";
} }
// Add a page number if necessary: // Add a page number if necessary.
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( esc_html__( 'Page %s', '_s' ), max( $paged, $page ) ); $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 } // end function _s_jetpack_setup
add_action( 'after_setup_theme', '_s_jetpack_setup' ); add_action( 'after_setup_theme', '_s_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function _s_infinite_scroll_render() { function _s_infinite_scroll_render() {
while ( have_posts() ) { while ( have_posts() ) {
the_post(); the_post();
get_template_part( 'template-parts/content', get_post_format() ); 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>' '<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; endif;
@ -107,13 +107,13 @@ function _s_entry_footer() {
/* translators: used between list items, there is a space after the comma */ /* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', '_s' ) ); $categories_list = get_the_category_list( esc_html__( ', ', '_s' ) );
if ( $categories_list && _s_categorized_blog() ) { 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 */ /* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', '_s' ) ); $tags_list = get_the_tag_list( '', esc_html__( ', ', '_s' ) );
if ( $tags_list ) { 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 ); $title = apply_filters( 'get_the_archive_title', $title );
if ( ! empty( $title ) ) { if ( ! empty( $title ) ) {
echo $before . $title . $after; // WPCS: XSS OK echo $before . $title . $after; // WPCS: XSS OK.
} }
} }
endif; endif;
@ -216,7 +216,7 @@ function the_archive_description( $before = '', $after = '' ) {
* *
* @param string $description Archive description to be displayed. * @param string $description Archive description to be displayed.
*/ */
echo $before . $description . $after; // WPCS: XSS OK echo $before . $description . $after; // WPCS: XSS OK.
} }
} }
endif; endif;

View File

@ -22,7 +22,9 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>
<?php <?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 * 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. * 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 get_template_part( 'template-parts/content', 'page' ); ?>
<?php <?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() ) : if ( comments_open() || get_comments_number() ) :
comments_template(); comments_template();
endif; endif;
?> ?>
<?php endwhile; // end of the loop. ?> <?php endwhile; // End of the loop. ?>
</main><!-- #main --> </main><!-- #main -->
</div><!-- #primary --> </div><!-- #primary -->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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