Trackbacks only as domain (3 posts)

  1. Rhys Wynne
    Volunteer Moderator
    Posted 8 years ago #

    Hi everybody :)

    I'm after a plugin/hack that does similar to this in WordPress:


    I can split the comments and trackbacks fine, but I'd like to do the neatness of the trackbacks with simply displaying the domain the trackback is from (leaving the URL as it is).

    Any suggestions for a plugin/hack that does this?

  2. Sooo.. you've got a URL, and you want to get the hostname only from it, right?

    Example code you can use to figure out how to make your theme do what you want:

    $url = 'http://example.com/someurl/whatever';
    $url_bits = parse_url($url);
    echo $url_bits['host'];
  3. Rhys Wynne
    Volunteer Moderator
    Posted 8 years ago #

    Thanks Otto, with a little bit of playing, this is what you should put (should you ever need it)

    $url_bits = parse_url($comment->comment_author_url);
    $url = str_replace("www." , "", $url_bits['host']);
    			<a href="<?php comment_author_url(); ?>"><?php echo $url; ?></a>,

Topic Closed

This topic has been closed to new replies.

About this Topic