Merge pull request #1267 from jrfnl/feature/cs-update

Bring code style up to the latest standards
- This PR addresses code-style issues identified when testing the code against the WordPress Coding Standards.
This commit is contained in:
David A. Kennedy 2018-03-02 18:45:51 -05:00 committed by GitHub
commit 72e34ef6bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 301 additions and 194 deletions

View file

@ -51,16 +51,16 @@ if ( ! function_exists( '_s_header_style' ) ) :
<?php
// Has the text been hidden?
if ( ! display_header_text() ) :
?>
?>
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that.
else :
?>
// If the user has set a custom color for the text use that.
else :
?>
.site-title a,
.site-description {
color: #<?php echo esc_attr( $header_text_color ); ?>;

View file

@ -112,36 +112,37 @@ if ( ! function_exists( '_s_entry_footer' ) ) :
endif;
if ( ! function_exists( '_s_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function _s_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function _s_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
if ( is_singular() ) :
?>
<div class="post-thumbnail">
<?php the_post_thumbnail(); ?>
</div><!-- .post-thumbnail -->
<div class="post-thumbnail">
<?php the_post_thumbnail(); ?>
</div><!-- .post-thumbnail -->
<?php else : ?>
<?php else : ?>
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
the_post_thumbnail( 'post-thumbnail', array(
'alt' => the_title_attribute( array(
'echo' => false,
) ),
) );
?>
</a>
?>
</a>
<?php endif; // End is_singular().
}
<?php
endif; // End is_singular().
}
endif;

View file

@ -161,7 +161,7 @@ if ( ! function_exists( '_s_woocommerce_wrapper_before' ) ) {
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
<?php
}
}
add_action( 'woocommerce_before_main_content', '_s_woocommerce_wrapper_before' );
@ -175,7 +175,7 @@ if ( ! function_exists( '_s_woocommerce_wrapper_after' ) ) {
* @return void
*/
function _s_woocommerce_wrapper_after() {
?>
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
@ -224,10 +224,16 @@ if ( ! function_exists( '_s_woocommerce_cart_link' ) ) {
*/
function _s_woocommerce_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', '_s' ); ?>">
<?php /* translators: number of items in the mini cart. */ ?>
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), '_s' ), WC()->cart->get_cart_contents_count() ) );?></span>
</a>
<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', '_s' ); ?>">
<?php
$item_count_text = sprintf(
/* translators: number of items in the mini cart. */
_n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), '_s' ),
WC()->cart->get_cart_contents_count()
);
?>
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo esc_html( $item_count_text ); ?></span>
</a>
<?php
}
}
@ -251,11 +257,11 @@ if ( ! function_exists( '_s_woocommerce_header_cart' ) ) {
</li>
<li>
<?php
$instance = array(
'title' => '',
);
$instance = array(
'title' => '',
);
the_widget( 'WC_Widget_Cart', $instance );
the_widget( 'WC_Widget_Cart', $instance );
?>
</li>
</ul>

View file

@ -17,6 +17,8 @@ function _s_wpcom_setup() {
// Set theme colors for third party services.
if ( ! isset( $themecolors ) ) {
// Whitelist wpcom specific variable intended to be overruled.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$themecolors = array(
'bg' => '',
'border' => '',