Drupal 7 Basic Theming

Posted on

in

,

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 *

About me

Mark Wong is a front end developer with 10+ years experience. Most of his knowledge of HTML5, CSS and Js is self taught.

Calendar

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031