Definition:
function get_post_reply_link($args = array() {}
Retrieve HTML content for reply to post link.
The default arguments that can be override are ‘add_below’, ‘respond_id’, ‘reply_text’, ‘login_text’, and ‘depth’. The ‘login_text’ argument will be used, if the user must log in or register first before posting a comment. The ‘reply_text’ will be used, if they can post a reply. The ‘add_below’ and ‘respond_id’ arguments are for the JavaScript moveAddCommentForm() function parameters.
Parameters
- array $args: Optional. Override default options.
- int|object $post: Optional. Post that the comment is going to be displayed on. Defaults to current post.
Return values
returns:Link to show comment form, if successful. False, if comments are closed.
Defined filters
- post_comments_link
apply_filters('post_comments_link', $before . $link . $after, $post)
Source code
function get_post_reply_link($args = array(), $post = null) {
global $user_ID;
$defaults = array('add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'),
'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => '');
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
$post = get_post($post);
if ( !comments_open($post->ID) )
return false;
if ( get_option('comment_registration') && !$user_ID ) {
$link = '<a rel="nofollow" href="' . wp_login_url( get_permalink() ) . '">' . $login_text . '</a>';
} else {
$link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
}
return apply_filters('post_comments_link', $before . $link . $after, $post);
}
1605

February 12, 2011 


No comments yet... Be the first to leave a reply!