How to Modifiy Drupal Bartik Theme-Create a Sub-Theme

Within a couple of weeks of starting your own blog with Drupal you may start to feel to modify the looks of your theme, which is quite normal among the bloggers. In fact, if you do not feel like that then you may not be as curious as others to try new functionality and features to your site. Let go straight to the point of this post: how to modify Bartik theme. Before start modifying your theme you need to know what a sub theme is (in case you are new to Drupal). In short, a sub-theme is just a child of a parent theme or core or base theme. In case of Drupal Bartik is the core or base theme  and if you want to modify it then you can do so either by directly modifying it or by copying it to a folder- the later process is called the sub-theme. A subtheme inherits all the properties of a mother theme which is modifiable without altering or affecting the codes of the base. And any customization in the sub-themes will not affect the base theme which in turn will not change the core codes of Drupal.

To modify your Bartik you need to follow the steps below:

For example you want to create a sub-theme from your Drupal Bartik theme, which is the base theme. When you install Drupal, the base themes (including the Bartik theme) are stored at /public_html/themes/ folder. The exact location of Bartik theme is /public_html/themes/Bartik..

To being with the creation of your Bartik sub-theme, you need to copy the Bartik theme from the above specified location and paste it in /public_html/sites/all/themes. Inside the themes folder, you will have the copied Bartik with the folder name of Bartik. Rename that folder name from bartik to say: nbartik.

Now, inside the new folder "nbartik" you have to change all the names of Bartik into "nbartik". You can use the coder editor to do this or copy all the codes; and paste it your test file and the press Ctrl+H and replace the bartik with the new name. The list of files you need to make name changes are:

color/preview.html

template.php

Now go to the following location:

/public_html/sites/all/themes/newbartik/css and change the style.css into nbartik.css to match the name of your subtheme. Then, go to the location public_html/sites/all/themes/newbartik and change the bartik.info file to newbartik.info. Then change the name field to your new sub-theme's name field. Delete the lines that giving package and version information. Add the following line:

 

base theme = bartik

stylesheets[all][] = css/nbartik.css

 

Next, delete all the other style sheet lines and save your .info file. Now you have created a subtheme for you Drupal and this new theme do not inherit the customs styles of the base theme. So, now, you are ready to modify the css of your new theme the way you like without modifying your base theme. and once you update the version of drupal your sub-themes will stay intact with all the modification that you make over the time.

For more information about how to modify a Drupal bartik theme you can have a look at the following sites:

  1. http://drupal.org/node/225125
  2. http://opensourcecms.pro/drupal/howto-drupal-7-sub-theme-creation-step-by-step/

If you do not like to modify any base theme and want to have a faster

Durpal then you can try out the following themes:

  • http://www.rockettheme.com/drupal-downloads/club/2588-quasar
  • http://www.rockettheme.com/drupal-downloads/club/2682-grunge

Read more about : how to update durpal core.

categories: