Support » Themes and Templates » Inserting Recent Posts into Footer
8 years, 10 months ago
I’m trying to display the 5 most recent posts of all categories in the footer. I used an existing theme and this is what is currently in the footer:
$myposts = get_posts('numberposts=4&offset=1');
if ($myposts) :
foreach ($myposts as $post) :
foreach (get_the_category() as $category)
$categories = $category->cat_name;
<li><a href="<?php the_permalink();?>"><span><?php the_title(); ?></span><em><?php the_date();?> in <?=implode(", ",$categories);?></em></a></li>
<?php else : ?>
But its alway showing ‘no entries’.
I know the recent posts sidebar widget works, and if better suited, how do I go about putting that into the footer?
I copied and pasted your code into my site’s sidebar and it worked fine… after I changed the line
Are you sure you actually have some posts? This code will not pick up Pages.