Ok, ich poste Dir mal ein
Widget, dass ich für eine meiner Seiten geschrieben habe. Das folgende muss so einfach in die functions.php Deines
Themes:
PHP-Code:
/**
* Displays the latest Book of the Month.
*/
function sd_widget_book_of_the_month($args) {
extract($args);
// start the widget
echo $before_widget;
echo $before_title . 'Book of the Month' . $after_title;
// get the latest book of the month posting
$temp_post = $post;
$sd_query = new WP_Query('cat=5&showposts=1');
// output the result if anything was found
if ($sd_query->have_posts()) {
while ($sd_query->have_posts()) : $sd_query->the_post();
the_excerpt('read more<span class="invisible"> of posting "' . the_title('', '', false) . '"</span>', 'read the whole posting', true, '[', ']');
endwhile;
} /* end if posts for category */
$post = $temp_post;
// end the widget
echo $after_widget;
}
// register the custom widget
$sd_class = array('classname' => 'widget_book_of_the_month');
wp_register_sidebar_widget('book_of_the_month', __('Book of the Month'), 'sd_widget_book_of_the_month', $sd_class);
Hier heißt das
Widget "Book of the Month", die Funktionen etc. musst Du natürlich entsprechend umbenennen. Ach, und kann sein, dass Du die Argumente der Funktion the_excerpt noch berichtigen musst. Ich nutze da immer meine eigene, angepasste Funktion...
Die obige Query liest den neuesten Beitrag aus einer bestimmten Kategorie aus. Du kannst die Query natürlich anpassen, je nachdem was Du da nun ausgelesen haben willst. Wenn es immer die gleiche statische Seite x sein soll, dann sähe die Zeile z.B. so aus:
PHP-Code:
$sd_query = new WP_Query('id=x&showposts=1');
Ich hoffe, das hilft Dir weiter. Bei Fragen einfach melden. :-)