Support » Plugins » Trackbacks only as domain

  • Rhys Wynne

    (@rhyswynne)


    Volunteer Moderator

    Hi everybody 🙂

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

    Separating WordPress comments from pings and trackbacks

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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'];

    Rhys Wynne

    (@rhyswynne)

    Volunteer Moderator

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

    <?php
    $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>,
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trackbacks only as domain’ is closed to new replies.