How to Include a List of WordPress Posts in a Page

There are times when you want to display a list of your posts within a page.

This functionality isn’t included in WordPress. Luckily, someone has made an excellent plugin that can bring this exact functionality to your site.

In this tutorial, you’ll learn what this plugin is and how to use it to display custom lists of posts in any page on your site.

How to Use the Posts in Page Plugin

First, download the Posts in Page plugin from wordpress.org, or via the Add New page in your Plugins menu.screenshot of the Posts in Page plugin on wordpress.org

Once installed, you’ll find a new Posts in Page menu under Settings. This menu provides you with a series of example shortcodes you can use to display lists of posts in pages.

screenshot of the Posts in Page menu

If you’re not familiar with WordPress shortcodes, visit our shortcodes tutorial before continuing.

For an experienced user, you may know what to do right away when you see the examples laid out on the settings page, but let’s go over five different examples of how these shortcodes can be used.

How to Show Five Specific Posts

If you wanted to show five specific posts in a page, you would format the shortcode like this:

[ic_add_posts ids='22,19,32,117,44']

Let’s break this down into simple pieces.

First, you’ll notice that the entire shortcode is wrapped in brackets. This is true for all shortcodes. Next, the ic_add_posts part is always at the beginning of the Posts in Page shortcodes. This is how the plugin knows to use the shortcode. Lastly, you can see the ids parameter.

Each post on your site has it’s own ID number. If you’re not sure where to find it, check out this post/page ID tutorial. The “ids” parameter simply says, “Find the posts with the following IDs”. The five posts with the corresponding ID numbers would then be displayed.

Let’s do another example and this should become clearer.

How to List All Pages

You can also use this plugin to list pages like this:

[ic_add_posts post_type='page']

You’ll notice the shortcode is the same except instead of searching for IDs, we’re searching by post type with the post_type parameter.

By default, WordPress has two post types: posts and pages. The shortcode above tells the plugin to fetch all pages, but you could switch this to “books”, “movies”, or any other custom post type you may have on your site.

How to List All Posts in One Category

This one is very useful. You can use it to show all the posts in one category:

[ic_add_posts category='design']

The example above would find all posts in the “design” category.

When adding your category, don’t use the name, use the slug. The slug is a modified version of the name that is all lowercase and uses hyphens in place of spaces. You can find the slug here in the category menu:

screenshot of category slugs in menu

How to List Posts in a Category and Tag

Let’s get a bit more advanced on this one.

This shortcode is only going to get posts that are in the Cooking Tips category and are tagged as Vegetarian:

[ic_add_posts category='cooking-tips' tag='vegetarian']

The Posts in Page plugin is flexible enough to support multiple parameters like in the shortcode above. You can use this to get very specific in your selection of posts.

How to List the Latest 10 Posts (and style them)

One last example. This one is especially for Compete Themes users:

[ic_add_posts showposts='10' template='content-archive.php']

By default, the shortcode will get all the posts. The “showposts” parameter then limits the number of posts fetched to 10. Those 10 latest posts will update as you publish new posts just like the standard blog page.

Lastly, these posts will use the content-archive.php template which is used for styling posts in all of our themes. If you’re not a Compete Themes user, you can look through the template files in your theme and find the right one needed to auto-style the posts.

Conclusion

With the Posts in Page plugin, you have complete control to display your posts. This allows you to create pages with one or more posts embedded in them, or design any kind of archive you want.

If you have any questions about the shortcodes or plugin used in this tutorial, drop a comment in the form below.

Related Posts

7 Comments
  1. Thanks for highlighting the Posts in Page plugin. I’m really glad you’ve found it useful enough to write about.

    We’re hoping to make some changes, add some new features, and streamline some old ones pretty soon.

    If you have any feature requests or suggestions, please feel free to let us know on GitHub here: https://github.com/ivycat/Posts-in-Page

    Cheers!

  2. Chris Chris

    Using [ic_add_posts showposts=’10’ template=’content-archive.php’]

    This doesn’t style the posts appropriately if a child theme is loaded. At the moment content-archive.php isn’t present in the child theme – I have reloaded the main theme and then the behaviour is closer to what I expect, although it doesn’t display full width so wraps the image and text and doesn’t look as expected.

    Is there a way to avoid having to copy content-archive into the child theme for this to work, and an easy way to make it full width using CSS which applies to that shortcode?

    Thanks!

  3. wow.. its very simple

Comments are closed.