Hallo Zusammen!
Ich habe mir für die Anzeige zufälliger Posts folgende Funktion installiert:
PHP
function get_random_posts()
{
$random_posts = get_posts(
array(
'numberposts' => 3,
'orderby' => 'rand'
)
);
$output = '<ul id="articleList">';
foreach($random_posts as $post)
{
$post_title = $post->post_title;
$post_permalink = get_permalink($post->ID);
$thumbnail = get_the_post_thumbnail($post->ID, '40x40_thumb',
array(
'class' => '',
'alt' => trim(strip_tags($post_title)),
'title' => trim(strip_tags($post_title)),
)
);
$output .= '<li><a href="' . $post_permalink . '" title="' . $post_title . '">' . $thumbnail . '<span>' . $post_title . '</span><div class="clear"></div></a></li>';
}
return $output . '</ul>';
}
Alles anzeigen
Wie schaffe ich es nun, einen Auszug mit anzuzeigen, z. B. mit 50 Zeichen?