Forums

Recent Posts on WordPress Page (3 posts)

  1. magnavox
    Member
    Posted 3 years ago #

    Hello,

    I am creating a static page for my blog homepage.
    I have about 4 paragraphs, and under the 4 paragraphs I would like to display the 5 latest posts.

    I have added the following code below the text:

    <h2>Recent Posts</h2>
    <?php wp_get_archives('title_li=&type=postbypost&limit=5'); ?>

    Problem is when I save the page and preview it, all I see is "Recent Posts", but no recent posts under that. Am I doing something wrong? Is there some easier way to do this?

    Thanks!

  2. figaro
    Member
    Posted 3 years ago #

    I don't think you are going to be able to put php code in the text editor and make it work...if it parsed that code it would be a huge security problem.

    There may be other ways to do this, but I think one way is to create a custom template page and add the php for your recent post to the template...then just use that template for your static page.

  3. MichaelH
    Volunteer
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic