Hallo zusammen,
unter meinen Artikeln sind 5 ähnliche Artikel mit Bild angezeigt - nun suche ich aber eine möglichkeit, dass nur das erste Bild angezeigt wird.
Hier der Code mit dem ich die ähnlichen artikel auslese:
<?php $orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>3, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo 'Mehr zum Thema:';
while( $my_query->have_posts() ) {
$my_query->the_post(); ?>
<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></div>
<div class="relatet-post">
<? }
echo '';
}
}
$post = $orig_post;
wp_reset_query(); ?>