7 days of unlimited WordPress themes, plugins & graphics - for free!* Unlimited asset downloads! Start 7-Day Free Trial
FREELessons: 11Length: 46 minutes

Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.6 Creating Fields

Every entry a user can create in a Craft CMS site has a set of associated fields. When you create a new entry type, you need to decide which fields to attach to it. In this lesson, let’s go through how fields are created and what you can do with them.

2.6 Creating Fields

Hey, welcome back to Up And Running with Craft CMS. In this lesson we're gonna to look at how you can set up custom fields. And we're gonna be setting up a field that will allow people to upload an image to their About Us page. And we're gonna use the asset source that we just set up. There are all kinds of different things you can do with custom fields. We're just gonna keep it simple for now but then we'll expand more on custom fields in the next course that we're gonna be doing after this where we're going to be creating a landing page from the ground up. All right, so let's jump into our Settings page, and from here we're gonna select Fields. Now you can see that there are already a couple of fields. If you recall, earlier on when we had a look at a news entry, we saw a body and tags in their entry. So these are those two fields that are responsible for those. In our About Us page, we're gonna wanna a body but we're also gonna want an image field. So we're gonna create that now by going up here and clicking New Field. So now just like we did with our section and our asset source, we need to give this a name. So let's call it About Us Image. Now if you want to, you can fill in this Instructions field if you feel like it's gonna be extra helpful to users to have a little bit more information about what they should be doing with the field that you're setting up. Then you need to select the field type. Now there are all kinds of different fields that you can choose from here. This is defaulted to plain text but there are form elements, color pickers, tables and all kinds of different things. On top of that, you can actually create plugins for Craft CMS, so we can add even more field types in there. For our purposes, we wanna connect this to the asset source that we just set up earlier, so that people can upload an image. So we're gonna choose Assets. And then to make sure that this is associated with the Image folder that we just set up, we gonna uncheck All and we gonna check Images. So now any image that gets uploaded through this field that we're setting up is gonna go straight into the Images folder that we created. Now we only want one general About Us page. So we're going to set this limit to one. And so people can see the thumbnails of the images that are available for them to choose from, we're gonna set View Mode to large thumbnails. And then we're gonna go back up to the top and click Save. So that's it. That's all it takes to create a custom field in Craft CMS. So anything that you need in your back end you can create on demand, just like that, any time that you like. So now we have everything that we need to set up our custom entry type, for our About Us page. We've got the section set up we've got the asset source set up and we've got the custom field set up that we need to connect that asset source to a custom entry type. So in the next lesson, we're gonna go ahead and create that custom entry type, so that the whole system is ready to have that About Us content added into the site. So I'll see it in the next lesson.

Back to the top