Hello WordPress users,
I’m currently building a website where I would like to display the date of a post on the hompage.
Currently I’m using the following code to do this:
$args = array( 'numberposts' => 2, 'category' => 2 );
$postslist = get_posts( $args );
foreach($postlist as $post) :
setup_postdata($post); ?>
<?php the_date(); ?> , <?php the_author(); ?>
<?php endforeach;
But this code is only working for the first post.
The first post displays:
april 1, 2013, admin
But all the other posts displays:
, admin
I can’t find out what is going wrong here.
Someone who can help me out?