Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Learn how to build an advanced portfolio site that showcases various types of content using the free open-source application WordPress. Author Morten Rand-Hendriksen demonstrates creating custom post types, differentiating and classifying content with custom taxonomies, and working with custom post templates. The course also shows how to embed YouTube videos, build index pages, display the latest posts from different custom post types, and hook custom post types into separate themes. Exercise files accompany with the course.
One of the really cool things about custom post types is that you can define what kind of functionalities they support. That way you can customize your custom post types to only ask for the kind of info you want and you can shape it to fit with the content you want to display. You can get pretty advanced with this stuff, but in this course I will spare you to madness and show you the standard functions and how to call them. All of this is done in an array placed in the supports variable. So if we look at the recipes, custom post type, when we scroll down a bit, you'll see we have this variable called supports.
And in the array, it says title, editor, and comments. If we go to the site itself and create a new recipe, you'll see we have a title, the editor, which is this area, where you put the regular content and comments, and comments is basically just the ability to turn comments and trackbacks on and off. What if we want to add some additional functionality to it? Well, there is a whole bunch of functionality we can add if we want to. So if you go to your code snippets, you see I have added the supports variable with a long array of content.
You can simply copy the whole thing and paste it in, in place of what is already there. I'll take away the comma for now and then we'll read it. The supports array says title, here is the title, the editor, and the author. We already have that, but in addition, it now says thumbnail which is the post thumbnail or featured thumbnail that we have in each post. It also says excerpt, which is the excerpt you can write if you want to, and of course we have comments and then also custom-fields. So you can new custom fields.
If we save this and go back to our editor and just reload the page, you will see that in addition to the title, editor, and comments, we now also have Featured Image here on the side, where you can add a new featured image. We have Excerpt, where you can add an excerpt. We have Custom Fields, Discussion and also Author, where you can define who wrote this. If you have multiple authors you can assign a different author to your content.
You can also add another variable at the end here, so if you say comma and then go down a line, you can add another variable called has_archive. Then give it an archive-name. So I'll copy that and paste it in. Now I'll just space it with equal. Now this has_archive variable is something we will come back to later. But for now, I will just say the archive -name as recipes, and leave it at that.
The reason why you have this has_ archive value is because later on we'll create an index page just for the recipes post type, and that recipe page has to have a name. So this name, has_archive name, actually defines the name of the index page. But like I said, we'll get back to that later. Now that we've added this supports array and the has_archive, to the recipes post type, we want to add it to all the other ones too. So I will simply go here and copy these two lines of text, copy it, scroll down until I find the same call inside the photos, custom post type, paste the old one in, and then change has_archive to photos, and I will scroll down and do the same for videos.
So here is the support. Paste it in and change to videos. And I now save it and go back to my editor, you will see when we create, a new Photo, we now have Featured Image, Excerpt, Custom Fields, Discussion, and Author, and the same for Add new video, Title, Editor, Excerpt, Custom Fields, Discussion, Author, Thumbnail.
If you want to make sure you have exactly the same thing I have, again you can go into the code-snippets and copy out the full code for posttypes.php and just paste it in and place it what you currently have and you'll end up for the exact same thing I have right now. By adding different functionalities to different post types, you can customize your post types to fit with the content you want to display. It's another simple way of making your site easier to administer and it gives you complete control over your content.
There are currently no FAQs about Create an Online Portfolio with WordPress.
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.