Hi,
I'm making a theme where on the top of each page will display the latest posts on the blog by using get_posts()
But Strangly it repeats the data of the page/post it is on at the moment such as the title and thumbnail.
if ( ! function_exists('costes_latest') ) :
function costes_latest() {
$latest_top_posts = array(
'numberposts' => 9,
'offset' => 0,
'category' => '',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish' ); ?>
<ul id="latest-posts">
<?php $top_posts = get_posts( $latest_top_posts );
foreach($top_posts as $post) : setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'costes' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<h3 class="entry-title"><?php the_title(); ?></h3>
<div class="excerpt-image"><?php if (has_post_thumbnail( $post )) { ?>
<?php the_post_thumbnail(array(220,200,crop) ); } ?></div>
</a>
</li>
<?php endforeach; ?>
<?php $post = $latest_tmp_post; ?>
</ul>
<?php }
endif;
Thanks for your suggestions