How To Create Sub-Theme in Drupal 7 ?

  0 comments
Share

Drupal has a very flexible theme system that allows a developer to easily create a sub theme. Sub-themes are similar to any theme. The difference between sub-theme and theme is: A sub theme is basically a copy of the parts of the parent theme which the web site builder would like to change.

Creating Sub-themes

Step 1:

Copy any parent theme from drupal\themes. Like we take bartik theme.

Paste it in drupal\sites\all\themes and rename it whatever you want to give name of your sub-theme.

Let's suppose our sub-theme name is my_subtheme

Note : This name must not contain any spaces or other special characters. The name of your sub-theme must start with an alphabetic character and can only contain lowercase letters, numbers and underscores.

Step 2:

Open my_subtheme folder and rename bartik.info as my_subtheme.info.

Open my_subtheme.info and change the name value. For example:

name = My Subtheme

Step 3:

Open template.php and find all bartik in this file and replace it with my_subtheme

Step 4

Put your logo and screenshot of your site in your subtheme folder

Note : The Screenshot and Logo of your site must be in .png format and named with screenshot and logo respectively

Step 5:

Now go to admin/appearance of your site and enable the my_subtheme and set default it.

Add new comment