Make WordPress Core


Ignore:
Timestamp:
10/27/2008 04:31:26 PM (16 years ago)
Author:
ryan
Message:

Make get_comment_link() paging aware. Props Viper007Bond. see #7956

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r9317 r9367  
    403403
    404404/**
    405  * Retrieve the link to the current comment.
     405 * Retrieve the link to a given comment.
    406406 *
    407407 * @since 1.5.0
     
    412412 */
    413413function get_comment_link($comment = null) {
     414    global $wp_rewrite;
     415
    414416    $comment = get_comment($comment);
    415     return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
     417
     418    if ( get_option('page_comments') ) {
     419        $page = get_page_of_comment( $comment->comment_ID );
     420
     421        if ( $wp_rewrite->using_permalinks() )
     422            return user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . "comment-page-$page", 'comment' ) . '#comment-' . $comment->comment_ID;
     423        else
     424            return add_query_arg( 'cpage', $page, get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID;
     425    } else {
     426        return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
     427    }
    416428}
    417429
     
    10861098<?php endif; ?>
    10871099
    1088         <div class="comment-meta commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php printf(__('%1$s at %2$s'), get_comment_date('F jS, Y'),  get_comment_time()) ?></a><?php edit_comment_link('edit','&nbsp;&nbsp;','') ?></div>
     1100        <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date('F jS, Y'),  get_comment_time()) ?></a><?php edit_comment_link('edit','&nbsp;&nbsp;','') ?></div>
    10891101
    10901102        <?php echo apply_filters('comment_text', get_comment_text()) ?>
Note: See TracChangeset for help on using the changeset viewer.