Pagination won't appear/work for wp_list_comments query
-
For some background, I added a nav-item to the buddypress menu that shows that person’s most recent comments, but I can’t get pagination links to show up. My code:
global $bp; $author_id = $bp->displayed_user->id; $args = array( 'user_id' => $author_id, 'orderby' => $order_by, 'order' => $order_dir,); ?> <div id="CommentListWrapper"> <ol class="comment-list"> <?php // show individual comments wp_list_comments('callback=mytheme_comment&type=comment', get_comments($args)); ?> </ol> <div class="comms-navigation"> <div style="float:left"><?php previous_comments_link(); ?></div> <div style="float:right"><?php next_comments_link(); ?></div> </div> </div><!-- #COMMENT LIST WRAPPER -->
with mytheme_comment function:
function mytheme_comment($comment, $args, $depth) { global $themePath; $GLOBALS['comment'] = $comment; $comm_title = get_the_title($comment->comment_post_ID); $feat_img = wp_get_attachment_url( get_post_thumbnail_id($comment->comment_post_ID) ); ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <article id="comment-<?php comment_ID(); ?>"> <div class="comment-text the-comment-container item-container"> <div class="the-comment-content"> <header class="comment-header"> <img src="<?php echo $feat_img?>" length="50" height="50" class="avatar"> <div class="comment-meta commentmetadata"> <?php comment_reply_link(array_merge( $args, array('reply_text' => __('Reply',THEME_NAME), 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> ? <?php edit_comment_link(__('Edit',THEME_NAME),' ','') ?> </div> <h4 class="poster-name"><cite><a href="<?php echo get_permalink($comment->comment_post_ID); ?>" rel="external nofollow" title="<?php echo $comm_title; ?>"> <?php echo $comm_title; ?> </a></cite></h4> <div class="comment-header-info clearfix"> <span class="date"><?php comment_date(); ?></span> </div> </header> <div class="comment-content"> <?php echo wp_html_excerpt( get_comment_text(), 500 ); ?> <?php if (strlen(get_comment_text()) > 500 ) : ?> ...<p><a href="<?php echo get_permalink($comment->comment_post_ID); ?>" rel="external nofollow" title="<?php echo $comm_title; ?>">Read more</a></p> <?php endif; ?> </div> <footer class="comment-footer"> <?php if ($comment->comment_approved == '0') : ?> <span class="awaiting_moderation"><?php _e('Your review is awaiting moderation.', THEME_NAME) ?></span><br /> <?php endif; ?> </footer> </div> </div> </article> <?php }
I’ve enabled comment pagination in the Discussion admin options, have tried setting the per_page for wp_list_comments and have tried using paginate_comments_links( ) instead of using the individual next and previous functions, but no matter what I do the pagination links will not appear. I can see different pages of comments by setting the “page” option in wp_list_comments, so I know they exist. The links for pagination just won’t show. Any help would be greatly appreciated.
- The topic ‘Pagination won't appear/work for wp_list_comments query’ is closed to new replies.