Created
October 22, 2015 15:00
-
-
Save yllus/55a178e745a5b5d4ab7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * The template for displaying Comments, Green News Sites | |
| * | |
| * The area of the page that contains comments and the comment form. | |
| */ | |
| global $post; | |
| global $current_user; | |
| global $wp_query; | |
| /* | |
| * 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. | |
| */ | |
| if ( post_password_required() ) { | |
| return; | |
| } | |
| //Check for related articles to determine how wide comments section should be. | |
| $comments_width = "comments col-lg-11 col-md-11 col-sm-16"; | |
| $related_links_plus = new Related_Links_Plus(); | |
| $related = $related_links_plus->get_related_links($post->ID); | |
| if ( !(is_array( $related )) ){ | |
| $comments_width = "comments col-lg-16 col-md-16 col-sm-16"; | |
| } | |
| if ( comments_open() ): | |
| ?> | |
| <div class="comments col-lg-11 col-md-11 col-sm-16"> | |
| <div class="comment-list"> | |
| <div class="starter-form">Join the conversation</div> | |
| <?php | |
| // Output the form to submit a new comment. | |
| $args = array( | |
| 'id_form' => 'commentform-' . $post->ID, | |
| 'title_reply_to' => ( '' ), | |
| 'title_reply' => ( '' ), | |
| 'comment_notes_after' => '', | |
| 'label_submit' => 'Submit', | |
| ); | |
| // Temporarily pretend like no WordPress user is logged in so that our commenting form looks to UMP for the user logged-in state. | |
| $current_user_temp = $current_user; | |
| $current_user = "TRASH_VALUE"; | |
| comment_form($args); // Display the comment form itself. | |
| $current_user = $current_user_temp; | |
| // To work with infinite scroll, we unset $wp_query->comments_by_type so we'll grab a fresh set of comments for the right article. | |
| unset($wp_query->comments_by_type); | |
| // Output the comments themselves (routed through Story::display_comments_list(), which makes use a specific view template). | |
| ?> | |
| <div class="scrollable-comment-list"> | |
| <?php | |
| wp_list_comments( | |
| array( | |
| 'type' => 'comment', | |
| 'callback' => array('Story', 'display_comments_list'), | |
| 'short_ping' => true, | |
| 'per_page' => 2, | |
| ) | |
| ); | |
| ?> | |
| </div> | |
| </div><!-- /.comment-list --> | |
| <div class="comments-bottom"> | |
| <?php if ( get_comments_number($post->ID) > 2 ): ?> | |
| <div class="loadmore"> | |
| <a class="loadcomments">Load More Comments</a> | |
| <div class="nomore"></div> | |
| </div> | |
| <?php elseif ( get_comments_number($post->ID) > 1 ): ?> | |
| <div class="loadmore"> | |
| <a class="hidecomments has_been_hidden">Hide All Comments</a> | |
| <div class="nomore"></div> | |
| </div> | |
| <?php endif; ?> | |
| </div> | |
| <div class="log"></div> | |
| </div><!-- /#comments --> | |
| <?php | |
| endif; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment