• I had a client for Elegant Webscapes request inline trackbacks. I did a search and found none posted in either the WordPress Hacks or WordPress Plugin pages. So, I decided to write one.

    • Copy the following code into your my-hacks.php file.
    • Include this tag < ?php inline_trackback('', 50, '<br />'); ?> on your index.php file where you want the inline trackbacks to appear.

    function inline_trackback($before = a€?a€?, $limit = 50, $sep = a€?a€?) {

    global $wpdb, $tablecomments, $id;
    $request = &quot;SELECT comment_author, comment_author_url, MAX(comment_ID) as comment_ID, SUBSTRING_INDEX(comment_content,a€?stronga€?,2) as trackback_title FROM wp_comments&quot;;
    $request .= &quot; WHERE comment_post_ID=a€?$ida€? AND comment_approved = a€?1a€2 AND comment_content LIKE a€?%trackback /%a€? GROUP BY comment_author, comment_author_url ORDER BY comment_ID DESC&quot;;
    $request .= ($limit > 0) ? &quot; LIMIT $limit&quot; : a€?a€?;
    $commenters = $wpdb->get_results($request);

    if ($commenters) {
    $output = a€?a€?;
    foreach ($commenters as $commenter) {
    if (!empty($commenter->comment_author_url)) {
    $output[] = $commenter->comment_author . a€? linked with comment_author_url . a€?a€? title=&quot;a€? . $commenter->comment_author . a€?&quot;>a€? . $commenter->trackback_title . a€?a€? . a€?a€?;
    }
    else {
    $output[] = $commenter->comment_author;
    }
    }

    if (is_array($output)) {
    echo $before.implode($sep, $output);
    }

    }

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Inline Trackbacks Hack’ is closed to new replies.