Hallo zusammen!
Ich habe in meinem Blog eine Funktion eingebaut, die die Top-Trackbacker anzeigt. Leider wird die URL zum Beitrag nicht korrekt ausgegeben. Anstatt der Bindestriche werden Leerzeichen ausgegeben.
PHP
function top_trackbacks_jahr() {
global $wpdb;
$toptrack_query="SELECT comment_ID, comment_date, DATE_FORMAT(comment_date, '%d.%m.%Y') AS comment_date_ger, comment_post_ID, SUBSTRING_INDEX(REPLACE( comment_author_url, 'www.', '' ) , '/', 3) as top_track, COUNT(*) as top_num FROM $wpdb->comments
WHERE comment_approved='1'
AND comment_type IN('trackback', 'pingback')
AND comment_date >= CURDATE() - INTERVAL 365 DAY
AND comment_author_url NOT LIKE 'http://domain.de%'
AND comment_author_url != ''
AND comment_author_url NOT LIKE 'http://twitter.com%'
GROUP BY top_track
Order by top_num DESC, comment_date DESC
LIMIT 3";
$toptrack_result = $wpdb->get_results($toptrack_query);
if ( !empty($toptrack_result) ) {
echo '<ul>';
foreach ($toptrack_result as $comment) :
$post = get_postdata($comment->comment_post_ID);
$tb_aut = $comment->top_track;
$tb_aut = str_ireplace("http://", "", $tb_aut);
echo '<li style="list-style-type:none"><br /><a href="'.$comment->top_track.'/" title="'.$comment->top_track.'"target="_blank">'.$tb_aut.'</a> ('.$comment->top_num.')<br />zuletzt am '.$comment->comment_date_ger.' in:<br /><a href="http://themenfreund.de/'. $post['Title'] .'" title="'.$post['Title'].'">'.$post['Title'].' </a></li>';
endforeach;
echo '</ul>';
}
}
Alles anzeigen
Wie kann ich es jetzt erreichen, das die URL korrekt ausgegeben wird. Denn hier wird das entsprechend angemeckert!
Danke im voraus!
Marcus