Site Map Mara Editing Advanced Step by step
print

The Theme - Step by Step

The theme.php file

As mentioned, this is basically a webpage.  As such, it has head and body sections, like so: 

<html>
  <head>
     Statements which determine how pages using this theme should be handled by the browser
  </head>
  <body>
    The content which will be displayed by the browser
  </body>
</html>

If you're familiar with webpages this should be instantly familiar. Being a php file, it can (and almost always will) contain server-side programming instructions. These are enclosed between <?php and ?> tags.

There is currently no online facility to edit themes. It is in any case more appropriate to edit these items directly.

If you're more used to working in a Web-form based environment, then it may be worth mentioning that these are text files. To edit them, you need a text editor. Windows comes with Notepad, which is suitable if a bit basic. Better choices are Geany or Notepad++. Both of these are free downloads from portableapps.com 

In general it's best to create a theme on your own computer and upload it once tested. Since the theme is pivotal to the presentation of the whole site, it really isn't a good idea to go making experimental changes to the live theme on a busy site.  Test first, then upload. Or, test under a different theme name, then rename the folder. If you prefer to work with themes directly on the site, then Filezilla, also from PortableApps, provides an easy way of editing online files directly without having to save them locally first. Alternatively, most implementations of CPanel provide a text editor function.

The contents of a theme, in CPanel

You may be be wondering if a theme should start with a !doctype declaration. The answer is that it doesn't matter. We'll see why later.

The head section of theme.php is the head section which will be used on actual webpages. Thus if you need to add calls to javascript or css files, this is where you put them. Not, in the page head section.

The body section is the actual page seen by the viewer. It will consist of  various content zones, some common to all pages, one specific to the page being viewed.  The content zones can be in any order or placement you like, and not all of the standard zones need be present. You can also add custom zones.