Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

darktranquilitynyc on "Most recent posts using get_posts()"

$
0
0

i got this from another thread, as the OP was trying to do what I'm trying to do.
I want to make the most recent blog posts come onto a static home page. I have a seperate link to the blog as a whole, but for this particular site, I don't want the blog to be the main page, only the most recent posts.
The code I got is

<?php
global $post;
$myposts = get_posts('numberposts=5 & category=1');
foreach($myposts as $post) :
?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endforeach; ?>

I put this in the index.php file within the content div.
My theme is 2012 in case it matters.

When I reload the page, none of the posts show up (not the latest ones.).
Thank you


Viewing all articles
Browse latest Browse all 8245

Trending Articles