WPservice DEVELOPMENT STUDIO PRESENTS
LONG-TERM GROWTH
We always design our websites with your future success in mind, carefully planning and optimizing all content to ensure maximum visibility and long-term profitability

Creating Your First Drupal Custom Theme – Most Important Drupal Theme Variables

drupal custom themeMaking a Drupal custom theme is probably easier than you think. Essentially, a Drupal theme consists of a CSS file, a handful of PHP files, and an information file. You have several choices for building a Drupal theme, but we recommend using the default PHP template theme engine.

Before you begin your custom Drupal development, head on over to your /themes directory before finding and selecting a theme called /bluemarine.

You need to then copy the theme to another directory where you will rename it.

Drupal Custom Theme Files

  • info – This is a required file that contains info about a theme
  • tpl.php – This is the main template file that you need for the content on your page
  • css – This is the sole CSS file
  • tpl.php – This designates the content of your codes
  • tpl.php – This designates the content of your blocks
  • tpl.php – This designates the content of your comments
  • png – This is your logo. It isn’t essential
  • png – This is used in the admin panel and is the screen short of your theme
  • tpl.php – This frames your comments with a box
  • style-rtl.css – This is only used for right to left languages and can otherwise be ignored

page.tpl.php and style.css

style.css and page.tpl.php are your main files. style.css is fairly straightforward and can be easily created using the Firefox Web Developer Toolbar.

The page.tpl.php is a little bit more complicated. It is a mix of PHP and HTML. Here is the code you need for /bluemarine:

<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>

Other Theme Files You Can Use For Custom Drupal Development

Other non-essential files you can use when developing your own Drupal custom theme are as follows:

  • tpl.php
  • tpl.php
  • tpl.php
  • tpl.php

It is important for theme development to be noted that each of these files is used for specific parts of your template. Each of them are fairly straightforward and you should have little trouble using them.

Your First Drupal Custom Theme

By now you should have made a copy of the /bluemarine template and dropped it in your /sites/all/themes/ directory, which you need to create first. Rename /bluemarine to a name of your own choosing.

You need to then remove most of the HTML from page.tpl.php before replacing it with your own HTML. The PHP can be modified sparingly.

The existing style.css can be modified, or you can start a brand new one from scratch.

As we already said – to make a drupal theme is probably easier than you think! When you are finished, resize a screenshot of your template to 150×190 pixels before uploading it to your theme directory.

Comments are closed.