1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
add_theme_support('menus');
add_theme_support('post-thumbnails', array( 'post' ));
add_editor_style();
 
function DisplayPingTrackbacks() {
 
    // Do not do anything if Disqus is not installed
    if(!dsq_is_installed()) return;
 
    $current_post_ID = get_the_ID();
 
    global $wpdb;
 
    $sql =     "SELECT comment_author_url, comment_author FROM $wpdb->comments WHERE comment_post_ID = $current_post_ID AND comment_approved = '1' AND (comment_type = 'pingback' OR comment_type = 'trackback') ORDER BY comment_date ASC";
 
    if ($post_pingtrackbacks = $wpdb->get_results($sql) ) {
 
        $number_of_pingtrackbacks = count($post_pingtrackbacks);
 
        if ($number_of_pingtrackbacks == 1) {
            echo "<div id='pingtrackback'><h3 style='font-size:14px;margin-bottom:10px'>En sidaa länkar hit</h3><ul>";
        } else {
            echo "<div id='pingtrackback'><h3 style='font-size:14px;margin-bottom:10px'>" . $number_of_pingtrackbacks . " sidor länkar hit</h3><ul>";
        }
 
        foreach ($post_pingtrackbacks as $post_pingtrackback) {
            echo "\n<li><small><a href='";
            echo $post_pingtrackback->comment_author_url;
            echo "'>";
            $author = $post_pingtrackback->comment_author;
            echo html_entity_decode($author);
            echo "</a>";
            echo "</small></li>";
        }
        echo "</ul></div>";
        }
}?>