• 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 = ‘’, $limit = 50, $sep = ‘‘) {

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

    if ($commenters) {
    $output = ‘’;
    foreach ($commenters as $commenter) {
    if (!empty($commenter->comment_author_url)) {
    $output[] = $commenter->comment_author . ‘ linked with comment_author_url . ‘� title=&quot;‘ . $commenter->comment_author . ‘&quot;>’ . $commenter->trackback_title . ‘‘ . ‘’;
    }
    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.