Support for Comments

When using “Standard AMP” (formerly “Native”) or “Transitional Mode” (formerly “Paired”) WordPress commenting will work on AMP-enabled pages (screencast, example page).

By setting the comments_live_list parameter to true, you’ll enable the ability to enhance the native WordPress commenting into a live updating system. See AMP Serving Strategies.

This removes the need for a page reload and will update based on new comments being posted in the background.

There is, however, a requirement in the code and markup of the theme to enable this further. In the comments.php file, you’ll need to wrap thewp_list_comments() call in an <amp-live-list>. Here is an example of a minimal implementation enabling this capability:

/** * Comments.php */ ?> <amp-live-list id="amp-live-comments-list-<?php the_ID(); ?>" data-max-items-per-page="10000"> <ol items class="comments__list"> <?php wp_list_comments( array( 'style' => 'ol', 'short_ping' => true, ) ); ?> </ol> <!-- .comment-list --> <div update class="live-list__button"> <button class="button" on="tap:amp-live-comments-list-<?php the_ID(); ?>.update"><?php esc_html_e( 'New comment(s)', 'ampconf' ); ?> </button> </div> <nav pagination> <?php the_comments_navigation(); ?> </nav> </amp-live-list>

For more details see this comments.php implementation.