WordPress.org

Forums

Change way URL displays on Post replies (3 posts)

  1. sincewelastspoke
    Member
    Posted 4 years ago #

    Hi,

    Right now in my WP3.0 install, if a user adds a URL along with the blog reply, it'll make their name hyperlink to that URL.

    However, I'd prefer not to have this.
    I'd like to place the URL next to the name, with no hyperlink.

    Can anyone suggest how I do this?

    I've looked in 'comment-template.php' in the includes, but couldn't find a thing :'(

    Thank you

  2. sincewelastspoke
    Member
    Posted 4 years ago #

    I'm looking to retrieve solely the URL value.

    How do I do this without having to use it in a hyperlink?

    Thank you

  3. vtxyzzy
    Member
    Posted 4 years ago #

    I think you can do what you want by adding a filter for get_comment_author_link. Try adding this to your functions.php:

    <?php
       function rework_comment_author_link ($link) {
         $comment_ID = 0;  // Use current comment
         $url    = get_comment_author_url( $comment_ID );
         $author = get_comment_author( $comment_ID );
    
         if ( empty( $url ) || 'http://' == $url ) {
           $return = $author;
         } else {
           $return = "$author " . htmlentities($url);
         }
       return $return;
       }
    
    add_filter('get_comment_author_link','rework_comment_author_link');
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.