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.
Just like with the custom post types, when you make a basic custom taxonomy WordPress defaults all the names to, well, the default, so either category or tag. You can see it here on the side. You'll see it says Meal type at the top here over the header, but on the bottom it says Add New Category. And that's kind of confusing. It should really say, Add New Meal type, right? Fortunately, just like with the custom post types, we can add an array of custom labels to our custom taxonomy, so it makes more sense. This is pretty much done in the exact same way we did for the Custom Post Type, and again I put the code into the code snippet, so you can just copy it out and paste it in.
So let's go to code-snippets file and you'll see under 04.04, we have this new array, m$eal_labels = array. We'll just copy the whole thing, go into our posttypes.php file, find the Meal type function and attach the array directly over register_taxomony. Looking at this, you'll see it's very similar to what we did for the custom post type. In the array, we have the name of the post type, so Meal type and it's a bit funny because Meal type is kind of the same plural and singular, but we still have to add the singular_name as well.
We also have search_items, so you can search in meal type. all_items, All meal types, and then we've this function for most_used_items, parent_items, and parent_item_colon. These you can turn on and off if you want to and you can see what they do. They are quite interesting, but they don't always apply. And then we of course have edit, update, add_new, add new, and menu_name. All these things are fairly obvious what they do. We've created the label, so now we need to remove our label down here in our similar_name just like we did for the Post types.
So I'll take out the similar_name line and under label, I'll change it to labels. Then I'll take Meal type out and replace it with $meal_labels, which is the name of the array just up here and when I save it and go back to my Admin Panel, you'll see that it now says Add new meal type down here, instead of just meal type. And you'll also see, when we go to Meal type up here, you'll see that it now says Add new meal type up here.
It says Add new meal type on the button, and it even says Search in meal type rather Search bar in the side here. This is again very simple stuff that doesn't seem all that important, but trust me, when people start working with this and they didn't build it, if you don't provide this information, they will get very confused really fast. And it's one of those small things, just like when you're building a house and you put in floorboards that makes that final touch of professionalism, and it makes it easier to use in general. So always remember to put in all the way of labels using this exact code.
And like before, if you want to get the exact function I'm using and you don't want to just copy and paste and hope that you're right, you can scroll down here to the Full function and simply copy the whole thing, all the way from Add custom taxonomies down to the end curly bracket, and just paste that into your posttypes.php file and you'll be good to go.
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.