WordPress.org

Ready to get started?Download WordPress

Forums

Trackbacks only as domain (3 posts)

  1. Rhys Wynne
    Member
    Posted 6 years ago #

    Hi everybody :)

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

    http://urbangiraffe.com/articles/separating-wordpress-comments-from-pings/

    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. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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
    Member
    Posted 6 years ago #

    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>,

Topic Closed

This topic has been closed to new replies.

About this Topic