Implementing WordPress Post Formats

By Kieran Hunter

Post formats are a great feature in WordPress that allow you to style different types of posts.

Adding the code below, into functions.php will bring up a selection of built-in WordPress Post Formats when inside the post editor.

Say for instance you have videos in one of your posts, you could select the video post format.

This will then add the class format-video inside the article. Allowing you to style it differently using this class in CSS. You could add a little video icon next to the post title to show it contains a video.

Adding content based on post format

The below code goes into your single.php and will return information based on whether the post is video format, and if it is, returns the content inside, like so.

Leave a comment