Display inline link with most recent post

Display Posts includes a few different options for wrappers (unordered list, ordered list, and div) but all of these are block-level elements. That means they display as their own unique block on the page.

If you want to display the most recent post inside a paragraph, we’ll need to use an inline element. The code snippet below lets you use the following shortcode:

[display-posts wrapper="span" posts_per_page="1"]

Since all the posts will show up on a single line, it’s probably best to limit it to a single post, as I’ve done above with the posts_per_page parameter.

Example

The most recent post on Display Posts is Display posts as a select dropdown.

Shortcode

The most recent post on Display Posts is [display-posts wrapper="span" posts_per_page="1"].

Code Snippet

This code snippet goes in a core functionality plugin or Code Snippets.

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.