Neueste Kommentare im WordPress-Widget zeigen den Kommentarinhalt an

Neueste Kommentare im WordPress-Widget zeigen den Kommentarinhalt an

Die Standard-Seitenleiste von WordPress verfügt über ein Widget für die neuesten Kommentare, das standardmäßig nicht den Kommentarinhalt anzeigt. Die folgende Änderung kann den Autor und den Inhalt des Kommentars anzeigen.
Ändern Sie die Datei: wp-includes/default-widgets.php
auftauchen:

 if ( $comments ) { // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); foreach ( (array) $comments as $comment) { $output .= '<li>' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; } }

Zu:

wenn ( $Kommentare ) {
foreach ( (Array) $Kommentare als $Kommentar) {
$output .= '<li class="recentcomments">' . /* Übersetzer: Kommentar-Widget:
1: Autor des Kommentars, 2: Link zum Beitrag */ sprintf(_x('%1$s : %2$s', 'widgets'),
get_comment_author_link(), '<a href=”' . esc_url( get_comment_link($comment->comment_ID) ) . '”>' . mb_strimwidth(strip_tags($comment->comment_content),0,46”;'utf-8′) . '</a>') . '</li>';
}
}

Der Anzeigeeffekt ist wie folgt:

<<:  Ajenti: Ausgezeichnetes Web-Management-Panel für Linux

>>:  Kostenloses VPS: Tutorial zur erfolgreichen Anmeldung bei vps.me und zur Nutzung gemeinsam genutzter IPs

Artikel empfehlen

GODADDY – 4,95 $ .COM, 1–10 Jahre

Kann registriert und übertragen werden, aber jede...

GigsGigsCloud 1 GB RAM 150 Mbit/s Port Japan SoftBank KVM VPS-Testbericht

Details : GigsGigsCloud: 45,6 $/Jahr/512 MB Speic...

Cochin Webhosting: 30 $/Monat/2 GB RAM/30 GB SSD/KVM/Singapur/Hongkong

Cochin Web Hosting, ein indischer Hosting-Anbiete...