Get the date of a post for each post
-
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, adminBut all the other posts displays:
, adminI can’t find out what is going wrong here.
Someone who can help me out?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get the date of a post for each post’ is closed to new replies.