Hallo!
ich habe folgenden Code in die Sidebar eingefügt, um die letzten Kommentare anzuzeigen:
PHP
<?php $comments = $wpdb->get_results("SELECT comment_post_ID, comment_author, comment_author_email, comment_content, comment_date
FROM $wpdb->comments
WHERE comment_type = ''
&& comment_approved = '1'
ORDER BY comment_date
DESC LIMIT 5"); ?>
<ul>
<?php $commenttype = 'even';
foreach($comments as $comment) {
$post = get_postdata($comment->comment_post_ID); ?>
<li class="<?php echo $commenttype; ?>">
<?php echo $comment->comment_author; ?> zu <a href="<?php echo get_permalink($post['ID']); ?>" title="">
<?php echo $post['Title']; ?></a>
</li>
<?php if($commenttype == "even") { $commenttype = "odd"; } else { $commenttype = "even"; } ?>
<?php } ?>
</ul>
Alles anzeigen
Das bewirkt aber, dass die Kommentarfunktion einer Seite geschlossen wird, auch von Pages, bei denen ich garkeine Kommentare erlaube, steht der typische "Kommentare geschlossen" - Text dort.
woran könnte das liegen?
Die sidebar.php sieht so aus:
PHP
<div id="sidebar">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar() ) : ?>
<h5 class="line_gradient">Navigation</h5>
<ul>
<!-- Vorbereiten der current_page_item klasse für die Home-Seite (=> wenn home seite aktiv, dann gib ihr die current class) -->
<?php if(is_home()) {
$cssclass = 'page_item current_page_item';
}else{
$cssclass = 'page_item';
} ?>
<li class="<?php echo $cssclass; ?>"><a href="<?php echo get_settings('home'); ?>">home</a></li> <!-- home als startseite inkludieren und ihr die currentpage klasse zuweisen -->
<?php wp_list_pages( 'sort_column=menu_order&title_li=&exclude=94' ); ?>
</ul>
<br />
<h2>Kategorien</h2>
<ul>
<li><?php wp_list_cats('optioncount=true'); ?></li>
</ul>
<br />
<ul>
<li><?php wp_list_bookmarks('orderby=rand&limit=5&title_li=Links'); ?></li>
</ul>
<?php $comments = $wpdb->get_results("SELECT comment_post_ID, comment_author, comment_author_email, comment_content, comment_date
FROM $wpdb->comments
WHERE comment_type = ''
&& comment_approved = '1'
ORDER BY comment_date
DESC LIMIT 5"); ?>
<ul>
<?php $commenttype = 'even';
foreach($comments as $comment) {
$post = get_postdata($comment->comment_post_ID); ?>
<li class="<?php echo $commenttype; ?>">
<?php echo $comment->comment_author; ?> zu <a href="<?php echo get_permalink($post['ID']); ?>" title="">
<?php echo $post['Title']; ?></a>
</li>
<?php if($commenttype == "even") { $commenttype = "odd"; } else { $commenttype = "even"; } ?>
<?php } ?>
</ul>
<?php endif; ?>
</div>
Alles anzeigen
würde mich über Anregungen und eure Hilfe freuen!
Danke und LG
Eva