Display Posts includes many display parameters for customizing what is displayed in the post listing output. You can include things like the post title, image, excerpt, content, date, author, categories, and more.
What is Metadata
Metadata is additional information about a post. Plugins use metadata to extend the functionality of WordPress. An events calendar plugin would store the event date as metadata. You can also create your own metaboxes.
Display metadata in Display Posts
The first step is to identify the meta key used for your metadata. If you’re trying to display metadata from a plugin, ask the plugin author for guidance.
Let’s use BE Events Calendar as an example. It stores the event start date with a key of
We’re going to add a new parameter to our shortcode,
include_event_date="true", for including the event date in post listings.
- On line 11, change
be_event_startto whatever key you’d like.
- On line 19, I’m converting the UNIX timestamp (stored by BE Events Calendar) into a formatted date, like July 4, 2019.
- On line 22, I’m wrapping it in
<span class="event-date">so we can style it with CSS.
- On line 25, I’m inserting our
$event_dateinto the output where I’d like it to appear (after the
$titleand before the
$date). You can move it to appear wherever you’d like.