< Back to Coding, Drupal 7

Drupal 7 Basic Theming

To make a sub theme, add a new folder with the name of your theme in sites/all/themes/[themename]

In that folder you need a text file called [themename].info. In it you need basic info like

name = [name that’s displayed in Drupal]
base theme = [name of theme this is based off eg bootstrap]
description = [more info that’s displayed in Drupal]
core = 7.x

To add custom css you’d add:

stylesheets[all][] = [css file name].css

Similarily to add js you’d add:

scripts[] = [js filename].js

To add external scripts like googlefonts, you’d copy a file called html.tpl.php from modules/system/ into your theme file. This contains the head tag that you can put your script in.

To edit the template for pages, copy a file called page.tpl.php from modules/system/ into your theme folder. To edit the template for the home page, rename the file to page-front.tpl.php

Leave a Reply

Your email address will not be published. Required fields are marked *