2.7 Creating Entry Types and Entries
We now have all the prerequisites in place for creating a new entry type, so let’s go ahead and step through how that’s done. Then we’ll see our custom entry type in action when we add the content for our “About Us” entry.
1.Introduction1 lesson, 01:04
2.Up and Running With Craft CMS9 lessons, 43:24
3.Conclusion1 lesson, 01:35
2.7 Creating Entry Types and Entries
Hey, welcome back to Up and Running with Craft CMS. In this lesson, we're gonna go through setting up the entry type for our About Us page. So we're gonna jump into the Settings area, then we're gonna go into the Sections. And we're gonna look for the About Us section that we created earlier. Now, it has automatically created the single entry type that's going to be associated with this About Us section, which remember singles are always one offs. So we're gonna edit that entry type and now, here is where we get to set up how this entry type is gonna work. This is where the asset source in the field that we set up earlier are gonna be used. Now this area that you see on the screen right now, this controls what the user is gonna see when they're entering content under a particular entry type. So you're basically designing the user interface right now. So what we're gonna do is hit this New Tab button here, and then we're gonna rename this to About Us. Now we can start adding in the fields that we want users to fill in when they're creating an entry under this entry type.. So, if we scroll up a little bit, you can see that the first thing we have here is the title. You can have titles automatically generated with code like you see in this box here. In our case we're gonna let the user fill in whatever they want as the title. To do that, we're just gonna click Show the Title field and then we'll give the title field a label, just Title will be fine. Now down at the bottom here, with the dashed lines, this shows us all the available fields that we can use in this entry type if we want to. And all we have to do is drag and drop the fields that we do want to use. So let's start with the About Us image. Now this is the field that we set up before. And this connects to the asset source that we also set up before. Under that, I'll be able to add in the body of the About Us page. Now we don't need to use tags, they're not relevant to this entry type. So, that is all we need to do. So now, we'll save what we've done and that's it. Now, our About Us entry type is completely finished and now that's also ready to have content added into the system. So when you're doing this, if you're working with the channel section type or a structure section type, you're gonna need to manually create the entries to correspond with those. But when you create a single, the system knows that you're gonna have one and one entry only, so it will automatically set it up for you. So if we go into entries now, there we can see that the system has automatically created our About Us entry. Now if we go into it, now we can see here is the UI that we set up when we're adding to different fields into our entry type. So we've got to title along the top, then we've got our About Us image where we can add an asset, and then we've got our body. So now, let's get everything filled out. We've already got a title that's been automatically added About Us. So we'll just leave that as it is. Now, we'll add in an asset. We're gonna add in an image. This is gonna go into the image folder that we created before. So, pick a image. Now that's uploaded. Now it's associated with our entry. And then finally, we'll just add some content down in the body field. Just a few paragraphs. So now, that is all done. We'll save. So now, we've gone through the whole process. We've done all the backend set up to create a custom About Us page and we've set up the content itself. Now all we need to do is set up a template that's gonna show our content when a user goes to the About Us URL. So in the next lesson, we're gonna look at the fundamentals of templating for Craft CMS. I'll see you there.