Display Posts Shortcode

The Display Posts Shortcode allows users to easily display listings of posts.

If you are using the Block Editor the Query Loop Block will do much of this, in a more visual way.

Add the shortcode in a post or page, and use the arguments to select based on tag, category, post type, and many other possibilities.

There are also some extra options to display something more than just the title: include_date, include_excerpt, and image_size.

You can also display the list in a Text Widget. See Embed Codes in widgets for details and examples.

For example [display-posts category ="news" ] will give you this:

display-posts-plugin

This technique is extremely powerful but can get tricky if you are trying for more advanced methods. The display-posts-shortcode Wiki on GitHub gives more details.


More Examples

[display-posts post_type="page" post_parent="743"]

Will show pages whose parent has the id of 743. This is the plugin page on this site.

A way to find out the id of a page: In the Post or pages list, hover over the post title and the id is in the link shown in your status bar:

Screenshot explaining how to get the id of a page from the page list.

Here we include an excerpt and the date and limit the number of posts to three.

[display-posts category ="releases" include_excerpt="true" include_date="true" posts_per_page="3"]

  • Glow Blogs October 2024 Update (10/24/2024) - Glow Blogs has just had a fairly large update. Glow Blogs is now using wordPress 6.6.2. This bring quite a lot of new features, especially to the Block & Site Editor. Quite a few plugins have been updated too.
  • Glow Blogs Update 14 Aug 2024 (8/14/2024) - We are pleased to announce a new release for Glow Blogs, which includes several fixes and updates to plugins and themes. Fixes Embedding Sways: Microsoft recently changed the URLs for Sway embeds, which disrupted the embedding process on Glow Blogs. The developers have now improved this process. We’ve also updated the help documentation to show how … Continue reading Glow Blogs Update 14 Aug 2024
  • Glow Blogs New “New Site” Functionality (4/16/2024) - The latest release of Glow Blogs makes a slight change to how you create a new site. There is an added choice when creating a site: You can choose between the Classic and Block editor. Choosing Classic will create a site with the default editor for posts and pages is the classic editor and the … Continue reading Glow Blogs New “New Site” Functionality

And here we don’t have a list but put each post in a div.

[display-posts category="issues-news-2" include_excerpt="true" wrapper="div" posts_per_page="3"]

Additional CSS Issue - In the most recent update to Glow blogs we updated the version of Jetpack that we use. Jetpack no longer supports Additional CSS. This is no longer available from the customiser or in the Styles of the Site Editor. CSS already added to sites continues to function. Native WordPress support Additional CSS but not in … Continue reading Additional CSS Issue
Jet Pack Settings Issue - Some sites with the Jetpack plugin enabled do not have a link in the Dashboard Sidebar. Our developers are aware of the problem and are working on a fix. Workaround The Jetpack settings can be accessed from the Plugins screen: Clicking on the Settings link under the Jetpack listing will take you to the Jetpack … Continue reading Jet Pack Settings Issue
H5P Issue Some content types cannot be installed - An issue with H5P content types has arisen. If you try to install some content types you will get an error. The problem seems to be because the H5P API has been updated but the version used by theWordPress plugin does not now match it.

More Advanced Examples

We can cange the appearance by using some custom css, this is added via the Jetpack Custom CSS module.

[display-posts category="news" include_excerpt="true" excerpt_length="20" wrapper="div" posts_per_page="3" wrapper_class="examplecss"]

Additional CSS Issue - In the most recent update to Glow blogs we updated the version of Jetpack that we use. Jetpack no longer… Continue reading Additional CSS Issue
Jet Pack Settings Issue - Some sites with the Jetpack plugin enabled do not have a link in the Dashboard Sidebar. Missing Jetpack icon Jetpack… Continue reading Jet Pack Settings Issue
Glow Blogs October 2024 Update - Glow Blogs has just had a fairly large update. Glow Blogs is now using wordPress 6.6.2. This bring quite a… Continue reading Glow Blogs October 2024 Update

CSS


/* for display posts shortcode page */
.page-id-1403 .examplecss .listing-item {
    width: 30%;
    float: left;
    padding: 3px;
}

.page-id-1403 .examplecss a.title {
    display: block;
    width: 100%;
    font-weight: bold;
    text-decoration: none;
    background: lightyellow;
    border: solid 1px #ccc;
}

.page-id-1403 .examplecss .excerpt-dash {
    display: none;
}


Featured Images

If your posts use featured images you can use them too. Here is an screenshot example from the Blogging Bootcamp #2 blog.

Sreenshot of a grid of images produced from featured images by the display posts plugin

This uses:

[display-posts category="announcement" wrapper="div" wrapper_class="ann-grid-layout" image_size="thumbnail" order="ASC"]

And this CSS:

.page-id-632 div.listing-item {
float: left;
width: 150px;
margin: 3px;
border: solid 1px #eee;
padding: 3px;
}

.page-id-632 .ann-grid-layout {
width: 500px;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Help for Glow Blogs

Report a Glow concern
Cookie policy  Privacy policy