Gallery2:How to Use A Separate Theme For WPG2 - Gallery Codex
Personal tools

Gallery2:How to Use A Separate Theme For WPG2

From Gallery Codex

Introduction

WPG2 is a WordPress plugin that integrates Gallery2 into a WordPress blog. This article shows how to use your Gallery2 installation's default theme when embedded within your WordPress blog while using the standard Matrix theme when your Gallery2 installation is accessed directly.

Setup

Require software

First, you'll need three pieces of software installed:

  1. WordPress
  2. Gallery2
  3. WPG2

All of these need to be working properly before you attempt any modifications. Starting with default settings on all of the above listed software is a good idea as it makes troubleshooting easier.

Gallery2 modules and themes

Modules

WPG2 requires that the Image Block and Image Frame modules be active.

Additionally, this technique will not work with the Gallery2 rewrite module activated. Using WordPress' permalink structures do not interfere and can be used.

Themes

You will need to have at least two Gallery2 themes installed and activated to use this technique.

Modifications

  1. Set the theme you would like to embed into your WordPress blog as the default Gallery2 theme. It is best, in the author's opinion, to have a very stripped-down, minimalistic theme for this purpose--one without any administrative or login links. Any theme should be compatible.
  2. Open [code]theme.inc[/code] in your chosen theme's directory, ie. [code]gallery2/themes/siriux/[/code].
  3. Find the line that sets the theme's ID. It should look something like [code]$this->setId('siriux');[/code].
  4. Immediately after that line, insert a new line: [code]if(strstr($_SERVER['REQUEST_URI'],'main.php')) $this->setId('matrix');[/code]
  5. Save the file, and upload back to the Web server if necessary.

Testing and verification of success

WordPress/WPG2

To verify that the correct theme--the default theme set in Gallery2's theme administration panel--is being used to display your photos through WPG2, type your WordPress blog's address into your browser's address bar and append [code]/wp-gallery2.php[/code]. You should see your albums and photos displayed using your selected theme.

Gallery2

To verify that the correct theme--Matrix, in this case--is being used to display your Gallery2 installation when accessed directly, simply access it directly through your Web browser. It should use the Matrix theme instead of the default theme you specified in the administration panel.