To add a theme, move it to the gallery/themes folder. For instance, if you have downloaded a zip file, unzip it and move the unzipped folder that contains the theme to the gallery/themes folder. The folder that contains the theme will have the files "theme.inc" and "theme.css" in it. There are many User contributed themes available.
The easiest way to create a new theme is by cloning a theme and then modifying it.
Pick a theme that is similar to the functionality that you want. We suggest that you start from one of the themes that comes with Gallery2 itself as those are usually the most current code. Your new theme will need a unique theme id. Ids are a single word that contains only alphanumerics and underscores and should be related to the name of your theme. So let's say that you're cloning the Matrix theme and making a new theme called MySite, you might give it the id mysite.
Let's start by making a copy of the matrix folder and all its contents, calling the new folder mysite. From a unix shell you can type:
cd gallery2/themes cp -R matrix mysite
Or just use your ftp client to make a copy. For instance, you can copy the matrix folder to your computer, then rename it and upload it back to the server.
Now let's edit mysite/theme.inc to set the details for your new theme. Edit mysite/theme.inc and inside you'll see a block that starts like this:
class MatrixTheme extends GalleryTheme { /** * Constructor */ function MatrixTheme() { global $gallery; $this->setId('matrix'); $this->setName($gallery->i18n('Matrix')); $this->setDescription($gallery->i18n('Standard Gallery2 look and feel')); $this->setVersion('0.9.9'); /* Update upgrade() also */
You need to change every reference of matrix to mytheme and adjust the description and version to be appropriate to your theme. These areas are marked below in bold:
class MySiteTheme extends GalleryTheme { /** * Constructor */ function MySiteTheme() { global $gallery; $this->setId('mysite'); $this->setName($gallery->i18n('My Site')); $this->setDescription($gallery->i18n('This is a theme for My Website')); $this->setVersion('0.9.0');
A few notes about this:
Now, go to the Site Admin and select the Plugins option from the left sidebar. Here, install your new theme. Then, click on Themes in the sidebar. Now you should see your "My Site" theme show up in the list.
Your theme should now be available for use! Edit an album and select your theme from the list and you'll be using your own personal copy of the Matrix theme!