Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Featured Images or Post Thumbnails as they used to be called, are an important feature in WordPress. In the post editor, you add the featured image separately from your regular post content and you can only add one feature image per post. Where and how that featured image appears is entirely up to the theme designer and developer. Before we start working with featured images, let me quickly explain how they work and how we can use them. When you create a post or a page, and you add content, including text, images, and other elements, all that content is stored in a single field within the database table.
That means when you call the content using the function the_content you call all of the content. Images, text, video, whatever else is in the content. This works well if you want to display all the content in a single post or if you want to display the full content in your index pages. But, there are many times when you want to display just a part of your content. Or you want to display just an image from a post. Or you may want to display the image. Separated from the content in a different place.
Maybe on an index page or as a highlight on a single post. In those cases, you'll want to use the featured image instead. The featured image lives separately from the post content. That means you can use the post ID to call in the featured image or post thumbnail separately. And you use the function called the_post_thumbnail to do that. This also means you can use both the_post_thumbnail and the_content in the same page, or you can use the_post_thumbnail in combination with the excerpt or anything else and you can make truly custom experiences.
You can also define multiple different sizes of the featured image. And then call a specific size to a specific location. So you can define an index-thumb size of 700 by 250. That will be called in on index pages, and then a larger version of 1060 by 450, that you call single-thumb, that will be displayed on single posts. Each of these will be the same image, and WordPress will just crop them to fit within these sizes. The reason why featured images are called post thumbnails in the function is because they used to be used for precisely that, post thumbnails.
You display the featured image in the index next to the post title and excerpt, and then when you clicked the image, you were taken to the full article. Today we use featured images for much more. So, therefore, the name within WordPress admin has changed. But the function name stays the same so that it's backwards compatible. In the theme we're working with in this course, we're going to add a large optional featured image to the top of our single post view, and a smaller one to each post in the index pages.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 59521 Viewers
61 Video lessons · 92372 Viewers
82 Video lessons · 104117 Viewers
56 Video lessons · 106903 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.