WordPress.org

Support

Support » How-To and Troubleshooting » Change way URL displays on Post replies

Change way URL displays on Post replies

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m looking to retrieve solely the URL value.

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

    Thank you

    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');
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change way URL displays on Post replies’ is closed to new replies.