
Updated for Elgg 1.8
Themes for Elgg are both extremely easy to develop and incredibly powerful. Using themes you can completely change how an Elgg install looks and feels (and even behaves).
By far the easiest and most flexible way to make a theme for Elgg is to build it as a plugin. This makes it easy to distribute (since they are self contained) and lets you turn the theme on and off from the admin panel (making the theming process far less invasive!).
Before you jump right in, it is advisable to familiarise yourself with Plugins and the Views system.
Contents |
Step one is to create your plugin as described in plugin development.
As of Elgg 1.8, the css is split into several files based on what aspects of the site you're theming. This allows you to tackle them one at a time, giving you a chance to make real progress without getting overwhelmed.
Here is a list of the existing CSS views:
There are two ways you can modify views:
The first way is to add extra stuff to an existing view via the extend view function from within your start.php’s initialization function.
For example, the following start.php will add mytheme/css to Elgg's core css file:
<?php function mytheme_init() { elgg_extend_view('css/elgg', 'mytheme/css'); } elgg_register_event_handler('init', 'system', 'mytheme_init'); ?>
Plugins can have a view hierarchy, any file that exists here will replace any files in the existing core view hierarchy... so for example, if my plugin has a file:
/mod/myplugin/views/default/css/elements/typography.php
it will replace:
/views/default/css/elements/typography.php
But only when the plugin is active.
This gives you total control over the way elgg looks and behaves. It gives you the option to either slightly modify or totally replace existing views.
In Elgg 1.8, we've provided you with some development tools to help you with theming: Turn on the "Developers" plugin and go to the "Theme Preview" page to start tracking your theme's progress.
In Elgg 1.7 and below, all css was contained in a single view: "css". Themes written for 1.7 will need to override/extend that view only.
Elgg comes by default with a specific set of view files. The view files used can change according the plugins you have installed. In the same way you can override or overload Elgg views, you can customize any plugin view. You will need to be sure that your plugin theme is in a lower lever in the Plugin Administration section.
This view has the principal user interface views, you will be main edit this folder file in order to customize your theme