 Welcome back to our API series And I just want to share with you how we're going to try to structure our data Of course I shared with you in our first video However, I just want to let you in on the big details about this before we dive into our code So classic press by default gives us posts It gives us media, it gives us pages, it gives us comments As default post types to use However, we can create our own post types and quite easily by writing a few lines of code Why would we need our own custom post type? It's because we're going to be collecting new data And I don't want to mix it with all the other things However, we shall be able to structure that post type And then send it to our endpoint or what we call our namespace So this is how we create our own custom post type So we're going to go to the right plugin And the first thing that we're going to do is make a function That creates with the name of create post type So then the next thing that we're going to do is actually we're going to By adding action And then in the add action we're going to just say Whenever we initialize Never initialize classic press Then we should call this function The create post type function So when we save that We'll be Oh, we need to add this in brackets And when we save that, that will be ready to go Next thing that we're going to do right now is We're going to call a function in WordPress Which is actually called register post type That will take in a number of variables in there So first things first It's going to take the name of our custom post type Which we're going to call villagers for now And then the next option that it takes It will take in an array of information actually So this array of information Includes a couple of things Fast and foremost in this array We're going to collect the labels The labels are basically how The labels are the things that allow us to Call things like you see how we have pages here Add all pages, add new If we quickly go to pages here This information we see here is pages And all pages and add new And edit and quick edit All this information can be shared through the labels So as for the labels We're also going to have an array Of those labels And giving the name The name which is going to be villagers And then we shall also give Something that is really needed Which is the singular name So that when we are calling for one item We have that already in So we're going to just give that And we're going to call that a village So after the singular name We'll go out of the labels section We're going to make it public Because we want this to be accessible To the public And this we shall activate By saying true If we changed it to false Then the public couldn't be able to query this So we'll leave it as true And then we will just say Whether it has an archive And for now We'll set it to true And leave it as that And then the other thing that is important Is what happens when we are going When we want to have a slag At the end of the day So this requires an array And inside here we'll need an argument For a slag And the slag we're going to just call it Villages So now that we've closed off our arrays Was closed up well Raise done We've executed this We're now going to just save this And what happens is When we go back and reload our page here Our village is coming in here It has a default icon We have villagers We can add a new village As you see And if you look here We have the slag Which is villagers For last here Now we have a couple of things here That are still saying something different Like adding new posts or whatever But we're going to correct that By adding more levels Into our Our poster registration And that will help us clear All those other things that Are quickly needed in there