Post Title Incorrect when looping?
-
Hi All,
I’m using a custom template for my homepage and I am trying to just find the 10 most recent posts and display them..I thought this would be simple.. but in the loop the_title() is displaying the page title instead of the title of the post??
function custom_content_boxes() { if (is_page('3')) { ?> <div class="home-news-scroller"> <?php $lastposts = get_posts('numberposts=3'); foreach($lastposts as $post) : setup_postdata($post); ?> <h2> <a href="" <?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?> </a> </h2> <?php the_content(); ?> <?php endforeach; ?> </div> <?php } }most wierd..
any help would be appreciated!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Post Title Incorrect when looping?’ is closed to new replies.