This is an empty Elgg theme plugin in which you can put CSS/JS/HTML customizations for your site.
Are you a new Elgg user eager to start customizing your site's look? You may be tempted (or even told) to jump in and modify core files; Don't Do This! Instead, install this plugin and make your modifications in it.
- Download a copy of this repository in your format of choice.
- Extract the archive into a new folder
MyTheme
. Aftwards this file should be atMyTheme/README.md
. - Move the
MyTheme
directory into/path/to/Elgg/mod
. - In Elgg's plugin administration page, activate "My Theme". Make sure it stays at the bottom of the plugin list after activating new plugins.
$ cd /path/to/Elgg/mod
$ git clone https://github.com/mrclay/Elgg1.8-MyTheme.git MyTheme
$ rm -rf MyTheme/.git
(optional step)- In Elgg's plugin administration page, activate "My Theme". Make sure it stays at the bottom of the plugin list after activating new plugins.
Add CSS to ./views/default/MyTheme/999/css/elgg.php
.
Add JavaScript to ./views/default/MyTheme/999/js/elgg.php
.
You can override English strings in ./languages/en.php
.
Place a copy of the view script (and its directory path) into ./views/default/
. E.g. when overriding a view named foo/bar
, you'll end up with ./views/default/foo/bar.php
.
Elgg imposes no convention on extension view locations, but it's wise to follow one. This plugin's init function MyTheme_init()
offers a simple wrapper to elgg_extend_view()
which sets the extension view based on the original view's name and priority:
The extending view name is always prepended with
MyTheme/###/
, where###
is the extension priority, left-padded with zeroes to 3 digits.
E.g., $theme->extendView('foo/bar', 60)
would cause Elgg to use this file for extending the foo/bar
view:
./views/default/MyTheme/060/foo/bar.php
.
After rending a view, Elgg passes the output through the hook ['view', $view_name]
. MyTheme offers a streamlined API for setting up a handler as a filter:
function MyTheme_init() {
...
$theme->filterView('foo/bar', 'MyTheme_filter_foo_bar');
...
}
function MyTheme_filter_foo_bar($content, $view_name, $view_params) {
return trim($content);
}