Creating Content Types in Drupal 7

Creating content types in Drupal 7

Creating Content Types

One of the features that makes Drupal so popular is the ability to create new content types without having to do any programming. In this video, we're going to start extending the style of content our site can manage we'll be doing this through Drupal's content type system.

In our Introduction to Content Types, we learn that content types are bundles of structure and options that template content for specific purpose. Various modules provides content modules for us, such as the article and basic page built in the core, but there are times when you want to create your own.

In this video, we're going to look at how we can build our own custom content type using just Drupal's admin. For the sake of an example, let's say that ACME Widgets wants to create a catalogue of their fine products. At first, we might try to do this by the built-in basic page content types and then approach the work, which is fine in some cases until we want to build more specialized features around these contents. Then it's better to organize the product nodes into a new content type.

So what are these more specialized features you might ask? What is it that driving us to create a new content type? Or it could be a number of things like creating a product focus listings like a catalogue or allowing people to filter a search to just look at products or maybe we want to add product specific data ware fields such as pricing or images. In a later video, we'll get more into why we want to create a new content type but for now, let’s just go ahead jump in and do it.

Creating a New Content Type

Creating a new content type is actually remarkably easy:

  1. We simply go to Structure > Content Types.
  2. Click on the "Add Content" type link.
  3. The only field we have to fill out is this name field. We’re building a product content types so I’m just go ahead and put a name product, I’m also going to put the description. This is something that let node authors know what types of contents the builders of the website thought was best to put into this particular type of node. There are some other settings that we’re going to look out in a minute but for now, just go ahead.
  4. Click save content type. And here we see our new content type listed with the other two built in ones. We also see our instructions to node authors, so let’s go ahead and create a new node of this content type. Go to add contents, then we click on product, and here we see a title and body field, so I’m just go ahead and add in our blue widgets and paste on somebody contents, scroll down and click save page. So now we have our first node of the product type.

Configuring Content Types

As we look around, there might be some things that aren’t quite set up the way we like. For example, maybe we don’t like this Publish By, or we don’t like commenting down in the bottom so we start tweaking out these settings.

The first thing that we'll do is let’s go ahead and open up the Node Edit form in another tab. One thing to look at is we have this "Title" field and this "Body" field. One way I like to think about fields is that they are sort of like buckets, and so you have this buckets that people can put things into. In this bucket, we can only put a single item of text. Here we can put a text area, and there’s other buckets that might have images and so forth but on the front of these buckets are different labels telling us what should go inside of them. And so our label may say Title and Body but we can change them to make it more descriptive.

Let’s take a look at how that works.

Editing Content Types

To edit our content type, we go back to structure, content types, and then we click edit underneath the content type we want to work with. And by scrolling down under this submission form settings, we see this "Title" field label. This is the label that goes on our Title buckets. Let’s change this to make it a little bit more sense for our product type. So change it to Product Name, scroll down, click Save. Now I go back over here, and when I hit refresh, this will change so now we get the more descriptive product name.

Changing Body Label

Let’s go change our body label while we’re at it. This is a slightly different place. Titles are built in to the core content type but body is actually a field. To get to that, we go to this Manage Fields, but we click on Edit underneath the body. We see that we have the same option that we can edit the label. So let’s change it to something like Description, scroll down, and click Save. When we do a refresh we see that this label has also changed the description. So these are really just buckets that have different labels on them; we can change them as we need to but people still put the same type of stuff into the buckets.

Altering Settings

So let’s go take a look at what kind of settings we can play around with. I want to flip back over to the Edit tab and look at our main settings, so scroll down to our Publishing Options. This looks ok except that we might not want a product promoted to homepage automatically, so let’s uncheck this. Now I'm going to run back over to my Node Edit form, hit Refresh, and scroll down to the part of the page that deals with Publishing Option. What we see is that it’s not unchecked; that’s because we’re set at the default settings for all new nodes when we selected that over on the content type.

What’s happen is that we’ve already created this node and it was created with these settings checked so it’s still checked. Any new nodes will no longer be checked. To see that, let’s just edit it to a new tab. We’ll create a product, run down on the Publishing Options, and we see that for new nodes it’s no longer checked by default. However, for this one that’s already created, we’re going to have to uncheck it and click Save. Now let’s go and look at how we can get rid of this Publish By user. Flip back over to Content Types, click Edit, and that setting is down here in the Display Settings. In fact it’s the only setting in Display Settings; go ahead and uncheck it, click Save content type, run back over and refresh our node. 

Type of Settings

One question might be: Why did the settings automatically change the node whereas the Promote to Front Page only affects a new node and we have to manually change it back in our node Edit form?

That’s because there are two different types of settings in our content type. One type can be set node-by-node, like a Promote to Front Page. But the Display Author and Date information can’t be set node by node; it’s true for the entire content type so it makes sense that it's automatically updated.

Now let’s go look at how to turn off these comments. As you probably already know, we can turn them off on an individual node using a Node Edit form but that becomes a little bit tedious for node authors. If we already know we’re not going to want commenting on any node of that type, let’s go ahead and turn it off on our content type. Let’s run back over to content types and then we'll edit the products and scroll down to Comment Settings. We’ll go over in more depth in another video what some of this settings mean, but for now I’m just going to use this top one. I can close them automatically but it’s better to go ahead and hide them altogether. I’ll click Hidden, Save content type, run back over to my node, and refresh. We should expect by now that it didn’t automatically turn off the comment here; we still have to do that. We can go to node edit, and now it’s gone; on any new nodes created of this type (if we scroll down on our comment settings) we see that’s it’s automatically closed.


The ability to create new content types is one of the central features that makes Drupal so flexible. In this video, we took a look at how to use the admin interface to create them. We also took a look at some of the core settings for the content types. There are many contributed modules that extend the features of content types and add to the settings we already reviewed. The real power of Drupal though comes from adding fields to content types. Now we can look at how to add new fields in the next few tutorials.