PHP Funktion – Letzte Kommentare auf Startseite mit DEBUG.LOG

Liebe Community,
ich verwende seit 14 Jahren (wirklich) die folgende Funktion um auf der Startseite die letzten Kommentare an zu zeigen.
/*** Lates Comments | Letzte Kommentare** @author Fabian Künzel, ** @version 0.0.4* @lastmodifided Son Nov 01 2009*/function recent_comments_theme() { global $wpdb, $comments, $comment; if ( !$number = (int) $options['number'] ) $number = 9; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $comments = $wpdb->get_results("SELECT comment_author, comment_author_email, comment_author_url, comment_ID, comment_post_ID, comment_content FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number"); if ( $comments ) { foreach ($comments as $comment) { $comment_titel = get_the_title($comment->comment_post_ID); $comment_titel = preg_replace("/[0-9]/", "", $comment_titel); $comment_titel = str_replace("Folge : ", "- ", $comment_titel); $comment_titel=""".$comment_titel.'"'; echo '<li>'. get_avatar( $comment, 55 ) .'<div class="meta">'. sprintf(__('%1$s im %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '" >'. $comment_titel .'</a></div>') .'<p><i>', comment_excerpt() ,'</i></p><div style="clear:both;"></div></li>'; } }}

die folgende Fehlermeldung:
Undefined variable: options

gemeint ist:
if ( !$number = (int) $options['number'] )

Ich überlege vor „global“ einfach zu definieren:

$options = array(
'number' => 9 // Standardwert für 'number'
);

Irgendwie fühlt sich das nicht richtig an. Welche Alternativen habe ich?

Danke für die Rückmeldung

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer