WordPress.org

Ready to get started?Download WordPress

Forums

Wrap cancel-comment-reply-link in div (2 posts)

  1. gilomen2
    Member
    Posted 2 years ago #

    I am using the simplified comment code for WP 3 for a theme I'm building, but I would like to wrap the cancel-comment-reply-link in a div so I can change it's appearance further. Is there anyway to do this?

    Here is the code from my comments.php

    [code moderated - please use the pastebin - the forum limit for direct posting of code is ten lines]

  2. Jerry
    Member
    Posted 2 years ago #

    You don't have to turn it into a div, you can just change the link to a block level element. Or if you want FULL control, just apply a filter to the comment link.

    From wp-includes/comment-template.php

    function get_cancel_comment_reply_link($text = '') {
          if ( empty($text) )
              $text = __('Click here to cancel reply.');
    
          $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
          $link = esc_html( remove_query_arg('replytocom') ) . '#respond';
          return apply_filters('cancel_comment_reply_link', '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text);
      }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags