I trust that you found this blog post to be enjoyable. If you are interested in having my team handle your eCommerce setup and marketing for you, Contact Us Click here.

Create custom theme in drupal-10

Create custom theme in drupal-10

A custom Drupal theme is a uniquely designed and developed visual  layout for a Drupal website. Unlike pre-built or contributed themes  available in the Drupal ecosystem, a custom theme is tailor-made to suit  the specific needs and branding requirements of a website. It involves  creating custom HTML, CSS, JavaScript, and template files to define the  website's appearance and layout. 

Step 1: First, we need to create a custom theme  

 under ‘your_project_name/themes/custom’  

 folder. We will name the folder as custom_theme.

ptiwebtech_website

Step 2: Next, we will need to create  

 an “your_custom_theme_name.info.yml" file. We need to   specify the basic keys for it.

ptiwebtech_website

Step 3: Now, let’s create a your_custom_theme_name.libraries.yml file  and We will also create CSS and JS directory and its files to   it in here 

ptiwebtech_website

Note: you must change the css and js according to your design   and requirements 

Step 4: After creating the libraries.yml file we are link to this file   to the theme that why we are link this file to info.yml file

ptiwebtech_website

Step 5: Now, we will define the ‘regions’ for our theme. In “info.yml”

ptiwebtech_website

Step 6: After define the regions we are creating “page.html.twig” file in folder of template in your directory just like blow 

ptiwebtech_website

Step 7: Now you go ‘appearance’ in your drupal project to see the  custme theme and install tha theme

ptiwebtech_website

After it is installed the theme and go to ‘Structure -> Block Layout.’ Your Custom Theme will appear under the Block Layout. 

ptiwebtech_website

➢ You are now almost done with theming in Drupal 10 

Step 7: If you need to write any hooks or create suggestions for your   twig file, you could add the “your_theme_name.theme” file   in your custom Drupal theme (shown below).

ptiwebtech_website
Back to blog