Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_comment_reply_link [ WordPress Function ]

get_comment_reply_link ( $args = array(), $comment = null, $post = null )
Parameters:
  • (array) $args Optional. Override default options.
  • (int) $comment Optional. Comment being replied to.
  • (int) $post Optional. Post that the comment is going to be displayed on.
Returns:
  • (string|bool|null) Link to show comment form, if successful. False, if comments are closed.
Defined at:



Retrieve HTML content for reply to comment 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.

Source


<?php
function get_comment_reply_link($args = array(), $comment null$post null) {
    global 
$user_ID;

    
$defaults = array('add_below' => 'comment''respond_id' => 'respond''reply_text' => __('Reply'),
        
'login_text' => __('Log in to Reply'), 'depth' => 0'before' => '''after' => '');

    
$args wp_parse_args($args$defaults);

    if ( 
== $args['depth'] || $args['max_depth'] <= $args['depth'] )
        return;

    
extract($argsEXTR_SKIP);

    
$comment get_comment($comment);
    if ( empty(
$post) )
        
$post $comment->comment_post_ID;
    
$post get_post($post);

    if ( !
comments_open($post->ID) )
        return 
false;

    
$link '';

    if ( 
get_option('comment_registration') && !$user_ID )
        
$link '<a rel="nofollow" class="comment-reply-login" href="' esc_urlwp_login_urlget_permalink() ) ) . '">' $login_text '</a>';
    else
        
$link "<a class='comment-reply-link' href='" esc_urladd_query_arg'replytocom'$comment->comment_ID ) ) . "#" $respond_id "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
    return 
apply_filters('comment_reply_link'$before $link $after$args$comment$post);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics