Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Add sort=ascending to amp-live-list for comments when asc order #84

Merged
merged 1 commit into from
Apr 2, 2018
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

<div class="comments wrap__item">

<amp-live-list id="amp-live-comments-list-<?php the_ID(); ?>" class="live-list" layout="container" data-poll-interval="<?php echo esc_attr( AMPCONF_LIVE_LIST_POLL_INTERVAL ); ?>" data-max-items-per-page="<?php echo esc_attr( get_option( 'page_comments' ) ? get_option( 'comments_per_page' ) : 10000 ); ?>">
<?php $sort_attr = ( 'asc' === get_option( 'comment_order' ) ) ? ' sort="ascending" ' : ''; ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this could be 'sort="ascending"' instead of ' sort="ascending" '. When this is echoed on the next line, there are already empty spaces before and after.

<amp-live-list id="amp-live-comments-list-<?php the_ID(); ?>" class="live-list" layout="container" <?php echo $sort_attr; // WPCS: XSS OK. ?> data-poll-interval="<?php echo esc_attr( AMPCONF_LIVE_LIST_POLL_INTERVAL ); ?>" data-max-items-per-page="<?php echo esc_attr( get_option( 'page_comments' ) ? get_option( 'comments_per_page' ) : 10000 ); ?>">
<ol items class="comments__list">
<?php
wp_list_comments( array(
Expand Down