Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #167 from brandonpayton/fix/linting-errors
Browse files Browse the repository at this point in the history
Fix linting errors causing the Travis build to fail
  • Loading branch information
kjellr authored Oct 18, 2018
2 parents 83ad463 + dba76ae commit b638bef
Show file tree
Hide file tree
Showing 24 changed files with 499 additions and 306 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{package.json,*.yml}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
4 changes: 2 additions & 2 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @subpackage Twenty_Nineteen
*/

get_header();
get_header();
?>

<div id="primary" class="content-area">
Expand Down Expand Up @@ -51,5 +51,5 @@
</main><!-- .site-main -->
</div><!-- .content-area -->

<?php
<?php
get_footer();

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php
/**
* TODO: File doc comment.
*
* @package WordPress
* @subpackage Twenty_Nineteen
*/

class Twenty_Nineteen_Walker_Comment extends Walker_Comment {
/**
* TODO: Class doc comment.
*/
class TwentyNineteen_Walker_Comment extends Walker_Comment {

/**
* Outputs a comment in the HTML5 format.
Expand All @@ -22,25 +31,29 @@ protected function html5_comment( $comment, $depth, $args ) {
<div class="comment-author vcard">
<?php
$comment_author_link = get_comment_author_link( $comment );
$comment_author_url = get_comment_author_url( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
$comment_author_url = get_comment_author_url( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
if ( 0 != $args['avatar_size'] ) {
if ( empty( $comment_author_url ) ) {
echo $avatar;
if ( empty( $comment_author_url ) ) {
echo $avatar;
} else {
echo preg_replace( '/>[^<]+</', sprintf( '>%s<', $avatar ), $comment_author_link );
echo preg_replace( '/>[^<]+</', sprintf( '>%s<', $avatar ), $comment_author_link );
}
}

/* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form. */
/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
/* translators: %s: SVG Icon */
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
/* translators: %s: SVG Icon */
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

/* translators: %s: comment author link */
printf( __( '%s <span class="screen-reader-text says">says:</span>' ),
printf(
/* translators: TODO comment on placeholders */
__( '%s <span class="screen-reader-text says">says:</span>' ),
sprintf( '<b class="fn">%s</b>', get_comment_author_link( $comment ) )
);
?>
Expand Down Expand Up @@ -71,13 +84,18 @@ protected function html5_comment( $comment, $depth, $args ) {
</article><!-- .comment-body -->

<?php
comment_reply_link( array_merge( $args, array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<div class="comment-reply">',
'after' => '</div>'
) ) );
comment_reply_link(
array_merge(
$args,
array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<div class="comment-reply">',
'after' => '</div>',
)
)
);
?>
<?php
}
Expand Down
92 changes: 51 additions & 41 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
* @subpackage Twenty_Nineteen
*/

/* If the current post is protected by a password and
/*
If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments. */
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
Expand All @@ -25,37 +27,37 @@
<h2 class="comments-title">
<?php
if ( comments_open() ) {
if ( have_comments() ) {
echo esc_html_e( 'Join the Conversation', 'twentynineteen' );
if ( have_comments() ) {
echo esc_html_e( 'Join the Conversation', 'twentynineteen' );
} else {
echo esc_html_e( 'Leave a comment', 'twentynineteen' );
echo esc_html_e( 'Leave a comment', 'twentynineteen' );
}
} else {
$comments_number = get_comments_number();
if ( '1' === $comments_number ) {
/* translators: %s: post title */
printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
$comments_number = get_comments_number();
if ( '1' === $comments_number ) {
/* translators: %s: post title */
printf( _x( 'One reply on &ldquo;%s&rdquo;', 'comments title', 'twentynineteen' ), get_the_title() );
} else {
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s reply on &ldquo;%2$s&rdquo;',
'%1$s replies on &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'twentynineteen'
),
number_format_i18n( $comments_number ),
get_the_title()
);
printf(
/* translators: 1: number of comments, 2: post title */
_nx(
'%1$s reply on &ldquo;%2$s&rdquo;',
'%1$s replies on &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'twentynineteen'
),
number_format_i18n( $comments_number ),
get_the_title()
);
}
}
?>
</h2><!-- .comments-title -->
<?php
// Only show discussion meta information when comments are open and available.
if ( have_comments() && comments_open() ) {
get_template_part( 'template-parts/post/discussion', 'meta' );
get_template_part( 'template-parts/post/discussion', 'meta' );
}
?>
</div><!-- .comments-title-flex -->
Expand All @@ -70,48 +72,56 @@
?>
<ol class="comment-list">
<?php
wp_list_comments( array(
'walker' => new Twenty_Nineteen_Walker_Comment(),
'avatar_size' => twentynineteen_get_avatar_size(),
'short_ping' => true,
'style' => 'ol',
) );
wp_list_comments(
array(
'walker' => new Twenty_Nineteen_Walker_Comment(),
'avatar_size' => twentynineteen_get_avatar_size(),
'short_ping' => true,
'style' => 'ol',
)
);
?>
</ol><!-- .comment-list -->
<?php

// Show comment form at bottom if showing newest comments at the bottom.
if ( comments_open() && 'asc' === strtolower( get_option( 'comment_order', 'asc' ) ) ) : ?>
if ( comments_open() && 'asc' === strtolower( get_option( 'comment_order', 'asc' ) ) ) :
?>
<div class="comment-form-flex">
<span class="screen-reader-text"><?php esc_html_e( 'Leave a comment', 'twentynineteen' ) ?></span>
<span class="screen-reader-text"><?php esc_html_e( 'Leave a comment', 'twentynineteen' ); ?></span>
<?php twentynineteen_comment_form( 'asc' ); ?>
<h2 class="comments-title" aria-hidden="true"><?php esc_html_e( 'Leave a comment', 'twentynineteen' ) ?></h2>
<h2 class="comments-title" aria-hidden="true"><?php esc_html_e( 'Leave a comment', 'twentynineteen' ); ?></h2>
</div>
<?php endif;
<?php
endif;

// Show comment navigation
if ( have_comments() ) :
$prev_icon = twentynineteen_get_icon_svg( 'chevron_left', 22 );
$next_icon = twentynineteen_get_icon_svg( 'chevron_right', 22 );
$prev_icon = twentynineteen_get_icon_svg( 'chevron_left', 22 );
$next_icon = twentynineteen_get_icon_svg( 'chevron_right', 22 );
$comments_text = __( 'Comments', 'twentynineteen' );
the_comments_navigation( array(
'prev_text' => sprintf( '%s <span class="nav-prev-text"><span class="primary-text">%s</span> <span class="secondary-text">%s</span></span>', $prev_icon, __( 'Previous', 'twentynineteen' ), __( 'Comments', 'twentynineteen' ) ),
'next_text' => sprintf( '<span class="nav-next-text"><span class="primary-text">%s</span> <span class="secondary-text">%s</span></span> %s', __( 'Next', 'twentynineteen' ), __( 'Comments', 'twentynineteen' ), $next_icon ),
) );
the_comments_navigation(
array(
'prev_text' => sprintf( '%s <span class="nav-prev-text"><span class="primary-text">%s</span> <span class="secondary-text">%s</span></span>', $prev_icon, __( 'Previous', 'twentynineteen' ), __( 'Comments', 'twentynineteen' ) ),
'next_text' => sprintf( '<span class="nav-next-text"><span class="primary-text">%s</span> <span class="secondary-text">%s</span></span> %s', __( 'Next', 'twentynineteen' ), __( 'Comments', 'twentynineteen' ), $next_icon ),
)
);
endif;

// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() ) : ?>
if ( ! comments_open() ) :
?>
<p class="no-comments">
<?php esc_html_e( 'Comments are closed.', 'twentynineteen' ); ?>
</p>
<?php
endif;

else:
else :

// Show comment form.
twentynineteen_comment_form( true );

endif; // if have_comments(); ?>
endif; // if have_comments();
?>
</div><!-- #comments -->
1 change: 1 addition & 0 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<div class="site-info">
<a class="site-name" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>,
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentynineteen' ) ); ?>" class="imprint">
<?php /* translators: TODO comment on placeholders */ ?>
<?php printf( __( 'Proudly powered by %s', 'twentynineteen' ), 'WordPress' ); ?>.
</a>
<?php
Expand Down
60 changes: 37 additions & 23 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,54 @@ function twentynineteen_setup() {
set_post_thumbnail_size( 1568, 9999 );

// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'twentynineteen' ),
'social' => __( 'Social Links Menu', 'twentynineteen' ),
) );
register_nav_menus(
array(
'menu-1' => esc_html__( 'Primary', 'twentynineteen' ),
'social' => __( 'Social Links Menu', 'twentynineteen' ),
)
);

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
)
);

// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'twentynineteen_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support(
'custom-background',
apply_filters(
'twentynineteen_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);

/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 190,
'width' => 190,
'flex-width' => false,
'flex-height' => false,
) );
add_theme_support(
'custom-logo',
array(
'height' => 190,
'width' => 190,
'flex-width' => false,
'flex-height' => false,
)
);

// Add support for Block Styles
add_theme_support( 'wp-block-styles' );
Expand Down Expand Up @@ -132,12 +146,12 @@ function twentynineteen_scripts() {
/**
* SVG Icons class.
*/
require get_template_directory() . '/classes/class.twentynineteen-svg-icons.php';
require get_template_directory() . '/classes/class-twentynineteen-svg-icons.php';

/**
* Custom Comment Walker template.
*/
require get_template_directory() . '/classes/class.twentynineteen-walker-comment.php';
require get_template_directory() . '/classes/class-twentynineteen-walker-comment.php';

/**
* Enhance the theme by hooking into WordPress.
Expand Down
Loading

0 comments on commit b638bef

Please sign in to comment.