3.6 The Content Pages (Part 4)
This is the final part of the content pages.
1.Introduction1 lesson, 01:20
2.Framework Basics2 lessons, 14:38
3.PHP Files16 lessons, 2:08:48
4.Finishing Touches2 lessons, 23:07
5.Conclusion1 lesson, 01:31
3.6 The Content Pages (Part 4)
Hey, welcome back! In the previous lesson, I finished the content.php file, which is responsible for displaying all of these posts that you see right here, and I also wrote the content-none.php which will be used in case there is no post to be displayed. But if we take a look inside index php, we can see that this line, get_template_part( 'content', get_post_format() ); this will load a different PHP file depending on the post format. So the gallery post format will be different than a quote post format. So in this lesson, let's go ahead and write those files. So the first thing I'll do is, go ahead and copy everything from content.php, because what we're about to write is very, very similar. So, if we take a look in functions.php, we can see that we support six post formats. So let's start with the first one, gallery. Create a new file called content-gallery.php, and paste this in. Okay, the default template for displaying posts with the gallery post formats. Okay, so what's different here? Well, the header will stay the same, except we don't have any post thumbnails to it. So we just have the title and the post meta. On the content, we won't have any excerpts, so we're just gonna display it like this using the_content and then wp_link_pages. And then the footer, basically stays the same. If we have an author description then we display it. Okay, and that's the content gallery. Next up is link. So okay, paste this in again, so this is gonna be content-link for displaying posts with the link post format. Now this is even simpler, because we don't have a header. All we need from this is the post-meta. So copy that, and delete the header, the_content, we don't have the_excerpt here either. Okay, and the footer in addition has the entry-meta. So we moved the entry-meta from the header to the footer, okay? Save that, next one is, let's do quote since it's very similar to the link. So copy the content from link, and then content-quote php. Yeah, again we have an entry-content. Everything is the same, except this bottom part, because it's a quote. It makes no sense in displaying the author, because that quote already has an author. So save that. Okay next up is the image. So the image will be the same as the gallery basically, so copy this. ContentImage.php and simply change here and here. So on this we don't have the thumbnail. Now we don't have the excerpt. And the rest is the same as the default content file. What else? Image quote we did. And then we have video. And for video, we're going to copy the content from gallery, since it's very similar. ContentVideo.php, paste that in. Video here, and video here. And let's see, we got a header. Now we got the meta, the content, and the footer. Okay. And finally, it's the audio, yes? So contentAudio.php. Paste that in again, and change that. As you can see, most of these templates are very similar. And this is just the way they are on this framework, but If you're developing your own theme, you might make them different. For example, the audio. You might not want any post meta on it. Or you might not want any author information on the bottom. It's totally up to you, how you customize it, all right? And remember, this is a framework, so it's gonna be applied over, and over, and over again to different themes. And those themes might have different layouts for these contents. For example, the gallery could be displayed in a particular way on one theme, and it can be displayed in a totally different way in another theme. So again, it's up to you, it's up to the theme you're building. OK, that completes the content pages, so let's take a quick look at the roadmap here. Let's see, we did the functions.php, index.php we still have to finish this. The contents, we did. So not bad, not bad. In the next lesson, I'm gonna finish this index.php. So I'll see you there.