Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment sorting support #1024

Merged
merged 2 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
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
33 changes: 0 additions & 33 deletions includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public static function init() {

self::purge_amp_query_vars();
self::handle_xhr_request();
self::add_temporary_discussion_restrictions();

require_once AMP__DIR__ . '/includes/amp-post-template-actions.php';

Expand Down Expand Up @@ -401,35 +400,6 @@ public static function intercept_post_request_redirect( $location ) {
wp_send_json_success();
}

/**
* Set up some restrictions for commenting based on amp-live-list limitations.
*
* Temporarily force comments to be listed in descending order.
* The following hooks are temporary while waiting for amphtml#5396 to be resolved.
*
* @link https://github.com/ampproject/amphtml/issues/5396
*/
protected static function add_temporary_discussion_restrictions() {
add_filter( 'option_comment_order', function() {
return 'desc';
}, PHP_INT_MAX );

add_action( 'admin_print_footer_scripts-options-discussion.php', function() {
?>
<div class="notice notice-info inline" id="amp-comment-notice"><p><?php echo wp_kses_post( __( 'Note: AMP does not yet <a href="https://github.com/ampproject/amphtml/issues/5396" target="_blank">support ascending</a> comments with newer entries appearing at the bottom.', 'amp' ) ); ?></p></div>
<script>
// Move the notice below the selector and disable selector.
jQuery( function( $ ) {
var orderSelect = $( '#comment_order' ),
notice = $( '#amp-comment-notice' );
orderSelect.prop( 'disabled', true );
orderSelect.closest( 'fieldset' ).append( notice );
} );
</script>
<?php
} );
}

/**
* Register/override widgets.
*
Expand Down Expand Up @@ -503,9 +473,6 @@ public static function register_content_embed_handlers() {
public static function amp_set_comments_walker( $args ) {
$amp_walker = new AMP_Comment_Walker();
$args['walker'] = $amp_walker;
// Add reverse order here as well, in case theme overrides it.
$args['reverse_top_level'] = true;

return $args;
}

Expand Down
Loading