How to create a custom post type in Drupal

December 23, 2022

Tags: Technologies, IT Staff Augmentation

drupal

 

When a website needs to be dynamic, constantly updated, and have the ability to integrate various content in one place, then a CMS platform like Drupal is used to achieve this.

 

To find out exactly what Drupal consists of, it is best to turn to the official source and read what the creators of this versatile technology explain on their website.

 

“Drupal is content management software. It's used to power many of the websites and apps you use every day. Drupal has great standard features like easy content creation, reliable performance, and excellent security. But what sets it apart is its flexibility; modularity is one of its fundamental principles. Its tools help you create the versatile and structured content that dynamic web experiences need,” they explain.

 

drupal

 

Custom content in Drupal

 

Drupal allows you to create a custom content type on your websites. The first step to achieve this is to get the base configuration ready for the content type, after that one or more additional fields can be added.

 

Step by Step

 

  1. Navigate to the content types page, clicking managed, then structure, then content types.
  2. Click Add Content Type.
  3. In the Name field, the name that the type of content will bear is placed, this is a mandatory step.
  4. In the description field, as its name indicates, the description of the content type will be written, this will be displayed on the add new content page. This is an optional step.
  5. Set your preferred base settings for this type of content. Any content you create of this content type will have these values by default. Values can be overridden for each content created. You can specify default values for submission form settings, post options, display settings, comment settings, and menu settings.
  6. When the base configuration is already saved, click either Save content Type or Save and add fields. Clicking on the first option will leave the post type with the title and body fields, while clicking on the second option will allow the person to add more fields to the post type.
  7. When adding fields you have the option to add a new one or an existing one.
  8. Once your content type has the desired fields, you can instantiate it as a node by navigating to the content page (Manage > Content). Then select the name of your content type.

 

After completing this series of steps, tap on the submission form settings: the Title field adds the title for the content type.

 

drupal

 

Then, the publication option is chosen, which are Published and Promoted. These are the default ones, but others are available. Immediately afterwards, the display configuration must be made, this allows the name of the author and the date of publication to be displayed in the content.

 

Regarding the comments in the type of content, they can be left open, closed or hidden. By default, 50 comments per page can be posted in a threaded list form, this is the best option.

 

To configure the menu, you just have to choose the main default item to use.

 

In this way, a type of personalized content is created in Drupal, a function of this technology that allows web pages to have special pages for all types of content, thus being able to adapt to technology trends and the need for information.

 

We recommend you on video