Ich habe bei mir in der Sidebar folgenden Code eingebaut:
PHP
kein_kommentar() {
global $wpdb;
$com_query= "SELECT post_type, post_title AS posttitle, ID, post_name AS postname, SUBSTRING(post_content,1,155) AS post_auszug, post_date, comment_status, comment_count FROM $wpdb->posts
WHERE comment_count = '0'
AND post_status = 'publish'
AND comment_status ='open'
AND post_type='post'
ORDER BY rand()
LIMIT 3";
$com_result = $wpdb->get_results($com_query);
if ( empty($com_result) ) {
echo '<h4 class="sidebar-title">Es gibt keinen unkommentierten Artikel</h4>';
}
foreach ($com_result as $comm) {
$ID = $com->ID;
$posttitle = $comm->posttitle;
$postname = $comm->postname;
$post_auszug = $comm->post_auszug;
echo '<div class="umfrage">';
echo '<li style="list-style-type:none"><div class="akt-titel"><a href="'. get_permalink($comm->ID).'" title="'.$comm->posttitle.'">'.$comm->posttitle.'</a><br />';
echo $comm->post_auszug.' ...</div></li></div>';
}
}
Alles anzeigen
Nun wird bei Artikeln die ein Bild enthalten versucht, dieses anstatt des Textauszugs einzublenden.
Wie kann ich das verhindern?