aeropause
Member
Posted 3 years ago #
I do a weekly "This week in news" and every time I have to copy/paste each title and link into a blog post.
Does anyone know how to show the last X number of post titles with links in a blog post?
I found this in the codex, but it just ouputs the PHP code:
<?php
$postslist = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($postslist as $post) :
setup_postdata($post);
?>
<div>
<?php the_date(); ?>
<br />
<?php the_title(); ?>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
Thanks a lot
shane
Stefanie
Member
Posted 3 years ago #
Try this:
<ul> <?php wp_get_archives('type=postbypost&limit=10'); ?> </ul>
Change 10 to whatever number of posts you want.
aeropause
Member
Posted 3 years ago #
Hey thanks for the reply. It didn't output anything though, just a blank screen :-(
Stefanie
Member
Posted 3 years ago #
If you're putting it into a post, you're going to need a plugin to execute php in posts. Exec-PHP is one.
aeropause
Member
Posted 3 years ago #
aeropause
Member
Posted 3 years ago #
well I got the plugin installed, published the post with that code you specified, but still nothing :-(