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

Comments template cleaned up and refactored #1296

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 7 additions & 90 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

if ( have_comments() ) :
if ( ( is_page() || is_single() ) && ( ! is_home() && ! is_front_page() ) ) :
?>
<section id="comments">
<?php
Copy link
Collaborator

@colin-marshall colin-marshall Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an <hr> here? I think it makes the the comments section easier to decipher from the post content with one.

EDIT: So it's clear, I'm talking right before the <section> element.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a good idea but also we still could add a line with CSS and border, which will avoid adding hr element...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already using an <hr> element between the comments and the leave a reply form.

Questions for everybody:

  1. Do we want a line in both places or just one of the places? (between post and comments, and between comments and comment reply form)
  2. Should we make this line with CSS or with <hr>?

Copy link
Contributor

@JPOak JPOak Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either remove the <hr> in both places or just add the <hr> element. I lean towards being less opinionated when it comes to design.

Copy link
Collaborator Author

@derweili derweili Sep 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the <hr> from the pull request

Expand All @@ -37,9 +36,11 @@
);

?>
<?php
the_comments_pagination();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we implemented Foundation pagination styles using custom SCSS classes here. Can this be done with that function? Or do we need to fix Foundationpress_Comments so it paginates?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I will update the pull request. I will replace the the_comments_pagination(); funktion with a Foundation specific one. Similar to the foundationpress_pagination() function.

?>
</section>
<?php
endif;
endif;
?>

Expand All @@ -65,96 +66,12 @@

<?php
if ( comments_open() ) :
if ( ( is_page() || is_single() ) && ( ! is_home() && ! is_front_page() ) ) :
?>
<hr>
<section id="respond">
<h3>
<?php
comment_form_title(
__( 'Leave a Reply', 'foundationpress' ),
/* translators: %s: author of comment being replied to */
__( 'Leave a Reply to %s', 'foundationpress' )
);
?>
</h3>
<p class="cancel-comment-reply"><?php cancel_comment_reply_link(); ?></p>
<?php if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) : ?>
<p>
<?php
/* translators: %s: login url */
printf(
__( 'You must be <a href="%s">logged in</a> to post a comment.', 'foundationpress' ),
wp_login_url( get_permalink() )
);
?>
</p>
<?php else : ?>
<form action="<?php echo get_option( 'siteurl' ); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p>
<?php
/* translators: %1$s: site url, %2$s: user identity */
printf(
__( 'Logged in as <a href="%1$s/wp-admin/profile.php">%2$s</a>.', 'foundationpress' ),
get_option( 'siteurl' ),
$user_identity
);
?> <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="<?php __( 'Log out of this account', 'foundationpress' ); ?>"><?php _e( 'Log out &raquo;', 'foundationpress' ); ?></a>
</p>
<?php else : ?>
<p>
<label for="author">
<?php
_e( 'Name', 'foundationpress' );
if ( $req ) {
_e( ' (required)', 'foundationpress' );
}
?>
</label>
<input type="text" class="five" name="author" id="author" value="<?php echo esc_attr( $comment_author ); ?>" size="22" tabindex="1" <?php if ( $req ) { echo "aria-required='true'"; } ?>>
</p>
<p>
<label for="email">
<?php
_e( 'Email (will not be published)', 'foundationpress' );
if ( $req ) {
_e( ' (required)', 'foundationpress' );
}
?>
</label>
<input type="text" class="five" name="email" id="email" value="<?php echo esc_attr( $comment_author_email ); ?>" size="22" tabindex="2" <?php if ( $req ) { echo "aria-required='true'"; } ?>>
</p>
<p>
<label for="url">
<?php
_e( 'Website', 'foundationpress' );
?>
</label>
<input type="text" class="five" name="url" id="url" value="<?php echo esc_attr( $comment_author_url ); ?>" size="22" tabindex="3">
</p>
<?php endif; ?>
<p>
<label for="comment">
<?php
_e( 'Comment', 'foundationpress' );
?>
</label>
<textarea name="comment" id="comment" tabindex="4"></textarea>
</p>
<p id="allowed_tags" class="small"><strong>XHTML:</strong>
<?php
_e( 'You can use these tags:', 'foundationpress' );
?>
<code>
<?php echo allowed_tags(); ?>
</code>
</p>
<p><input name="submit" class="button" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e( 'Submit Comment', 'foundationpress' ); ?>"></p>
<?php comment_id_fields(); ?>
<?php do_action( 'comment_form', $post->ID ); ?>
</form>
<?php endif; // If registration required and not logged in. ?>
<?php comment_form(array(
Copy link
Collaborator

@colin-marshall colin-marshall Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format like this:

    <?php
    comment_form(
        array(
            'class_submit' => 'button'
        )
    );
    ?>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the pull request

'class_submit' => 'button'
)); ?>
</section>
<?php
endif; // If you delete this the sky will fall on your head.
endif; // If you delete this the sky will fall on your head.