Display default image

The image_size parameter lets you include a thumbnail in your post listing, but it only works if the post has a featured image attached to it.

The code snippet below lets you specify a default image ID to use in case a post doesn’t have a thumbnail. You can find the image ID by going to Media, selecting the image, and looking at the URL (ex: ?item=80 ).

[display-posts image_size="thumbnail" default_image="80"]

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

Filters used:

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.

Leave a comment

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