Bonjour,
je cherche à afficher sur ma home page les deux dernier commentaire avec le résultat d’un rating d’une autre table… Lorsque je lance la requête dans PhpMyAdmin j’ai le bon résultat… Mais dans ma home page le résultat reste VIDE…
<?php
global $wpdb;
$sql = "SELECT *
FROM $wpdb->bxlC_comments JOIN $wpdb->bxlC_commentmeta ON ($wpdb->bxlC_comments.comment_ID = $wpdb->bxlC_commentmeta.comment_id)
WHERE $wpdb->bxlC_comments.comment_approved = ‘1’
ORDER BY $wpdb->bxlC_comments.comment_date_gmt DESC
LIMIT 2″;
$comments = $wpdb->get_results($sql);
$output = « n<ul>« ;
foreach ($comments as $comment) {
$output .= « n<li>« .strip_tags($comment->comment_author)
. »: » . « <a href="" . get_permalink($comment->ID) .
« #comment- » . $comment->comment_ID . « » title= »on » .
$comment->post_title . « »> » . strip_tags($comment->com_excerpt)
. »</a></li>« ;
}
$output .= « n</ul>« ;
echo $output; ?>
Merci