• Resolved steelfrog

    (@steelfrog)


    I’m trying to figure out how I could do the following.

    I have a row of buttons for each comment. One of them is the “edit” button which I would only like to display if the user has the right to edit said comment.

    Using the default edit_comment_link() function does not work for me as I need to include a span inside the anchor tag.

    Here is the HTML that displays the edit button and a ‘tooltip’ when user mouses over the button, hence the span:

    <li class="edit"><a href="#" title="Edit this comment"><span>Edit this comment</span></a></li>

    I figure there must be a way to set a condition to display the link based on the user’s status, but I don’t know what I’m looking for.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter steelfrog

    (@steelfrog)

    Found the function to get the link: <?php echo get_edit_comment_link() ?>, but now I need to find a condition that checks if the user has the right to edit the post or not so it can toggle its display.

    And what was wrong with
    <?php edit_comment_link('<span>Edit this comment</span>', '<li class="edit">', '</li>'); ?>

    Thread Starter steelfrog

    (@steelfrog)

    Simply put, the <span> needs to be inside the anchor as so: <a href="#"><span>Content</span></a>

    And that’s exactly what it does. Let’s try it again:

    <?php edit_comment_link('<span>Edit this comment</span>', '<li class="edit">', '</li>'); ?>

    Thread Starter steelfrog

    (@steelfrog)

    Sorry it took so long. I assumed no one else had replied to this post. Your solution worked perfectly, nebulus. Thank you! Post marked as resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customized ‘edit comment’ link?’ is closed to new replies.