Hallo habe das Recent Comments Plugin bei mir installiert und alles klappt auch soweit.
Jedoch moechte ich, dass es mir das Datum in einem lesbaren Format anzeigt.
Ich hab die Variable $comment_date eingefuehrt und das Plugin liest sie auch ohne Probleme aus der Datenbank aus. Jedoch wuerde ich gerne das Format aendern. Momentan sieht es noch so aus 2006-08-04 14:35, ich wuerde einfach nur gerne 04. Aug dastehen haben.
ich habe versucht das Format mit einer Klammer nach $comment_date zu aendern, geht aber nicht, da stuerzt mir sogar der ganze Blog zusammen!
Hier mal der Code, ist die 11te Zeile von unten (ganz nach unten scrollen, dann seht ihr schon "[COLOR=#0000cc]$output [/COLOR][COLOR=#006600].= [/COLOR][COLOR=#0000cc]$before [/COLOR][COLOR=#006600]. [/COLOR][COLOR=#cc0000]'Am ' [/COLOR][COLOR=#006600]. [/COLOR][COLOR=#0000cc]$comment_date [/COLOR][COLOR=#006600]. [/COLOR][COLOR=#cc0000]' schrieb '..."[/COLOR][COLOR=#006600].[/COLOR]) Diese muss geaendert werden, weiss aber leider eben leider nicht wie...
Danke schon mal...
<?php
/*
Plugin Name: Recent Comments
Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/
Description: Retrieves a list of the most recent comments.
Version: 1.18
Author: Nick Momrik
Author URI: http://mtdewvirus.com/
*/
function mdv_recent_comments($no_comments = 5, $comment_lenth = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $comment_style = 0) {
global $wpdb;
$request = "SELECT ID, comment_ID, comment_content, comment_author, comment_date, comment_author_url, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') ";
if(!$show_pass_post) $request .= "AND post_password ='' ";
$request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $no_comments";
$comments = $wpdb->get_results($request);
$output = '';
if ($comments) {
foreach ($comments as $comment) {
$comment_author = stripslashes($comment->comment_author);
if ($comment_author == "")
$comment_author = "anonymous";
$comment_content = strip_tags($comment->comment_content);
$comment_content = stripslashes($comment_content);
$comment_date = stripslashes($comment->comment_date);
$words=split(" ",$comment_content);
$comment_excerpt = join(" ",array_slice($words,0,$comment_lenth));
$permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
if ($comment_style == 1) {
$post_title = stripslashes($comment->post_title);
$url = $comment->comment_author_url;
if (empty($url))
$output .= $before . $comment_author . ' on ' . $post_title . '.' . $after;
else
$output .= $before . "<a href='$url' rel='external'>$comment_author</a>" . ' on ' . $post_title . '.' . $after;
}
else {
$post_title = stripslashes($comment->post_title);
$output .= $before . 'Am ' . $comment_date . ' schrieb '. $comment_author.':<br><a href="' . $permalink;
$output .= '" title="dieser Kommentar wurde zu ' . $post_title .' geschrieben...">' . $comment_excerpt.'...</a>' . $after;
}
}
$output = convert_smilies($output);
} else {
$output .= $before . "Nichts..." . $after;
}
echo $output;
}
?>
Alles anzeigen