Update: I am now using google picasa with the kpicasa plugin. I've determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this method will work, but over time if you ever make a change to your wordpress theme, you have to update your look-alike zenphoto theme. Common plugins for zenphoto wordpress integration allow you to put individual albums or photos into posts.
After reading Frank's post on using wordpress functions outside of wordpress, I had a good idea: Make a zenphoto theme with the wordpress navigation. This allows a nearly seamless level of integration between zenphoto and wordpress. The best starting point for this outline is if you already have a nice looking wordpress theme. The result of this will give you a wordpress "page" that redirects to a lookalike wordpress zenphoto theme complete with wordpress navigation, footer, page title, header, etc. First, you need a way of getting the paths of the blog directory, and the zenphoto directory. I have a www/blog/ folder and a www/gallery/ folder in this example. Place config.php in www/ config.php
< ?php
/* config file to unite wordpress and zenphoto */
define('BLOG_PATH', "$_SERVER['DOCUMENT_ROOT']/blog");
// do a var_dump($_SERVER); to find out what something is
define('GALLERY_PATH', "$_SERVER['DOCUMENT_ROOT']/gallery');
?>
You may have to var_dump($_SERVER) to find out the best way of getting to your site's directory. Okay, we have paths to reference from zenphoto to get to the wordpress directory. Let's dig into a zenphoto theme. Zenphoto themes are laid out with various files that are called depending on if you are at the zenphoto homepage (index.php), or if you have clicked on an album (album.php), or an image (image.php) and a few others. Your best bet is to copy the 'default' zenphoto theme to a folder with a different name, such as nate-theme, then modify it. Let's look at index.php The first step is to follow Franks post and include the wordpress loader wp-load.php. Put at the very top of your zp-themes index.php file:
< ?php
require_once("{$_SERVER['something']}/www/config.php");
require_once(BLOG_PATH."/wp-load.php");
// var_dump(get_current_theme()); // call this to see the name of the wordpress theme activated
if (get_current_theme() == "My Wordpress Theme") // if the current theme is my wp theme, use it. otherwise use default zenphoto theme
{?>
// wordpress html+php here
< ?php
}else{
?>
// original zenphoto default index.php file here
<?php
}
?>
This is in case the wordpress theme get's changed to something else, zenphoto will revert back to the original html/php — whatever is in the else statement. So then, just copy the basic html structure from the header.php footer.php index.php files from your wordpress theme. You can now call the functions for listing the navigation, wp_list_pages(), getting options get_option(), getting blog title and other information bloginfo(), etc. One requirement for this to work, is that the zenphoto and wordpress functions don't interfere. Luckily, no two functions have the same name, and so this does work. I haven't tested recreating the sidebar widgets in the zenphoto theme, although it should theoretically work. As for the zenphoto style sheet, I played a trick on apache to make this work. I told apache to parse .css files in the styles/ directory of zenphoto theme as a php file. Just make a .htaccess file in the styles directory, and add this line to it: AddType application/x-httpd-php .css This will allow you to apply the same technique as the index.php page with the if get_current_theme==xx else block. Just use the normal css in the else, and the wordpress css in the if parts. The last step to making this a nearly seamless integration is following my previous post on hardlinking the navigation. create the custom field redirect to the key /gallery/ or the url path to your gallery.

Pingback: Zenphoto » Integrating Zenphoto into Wordpress Tutorials
#1 by Alejandro on November 24, 2009 - 8:13 am
Quote
Hi man… first of all, the tutorial sound nice, it seems to be very very easy to implement, but I have a little question: what do you mean when you said SOMETHING when we have to specify a path?
I mean:
require_once(“{$_SERVER['something']}/www/config.php”); Where say something, I’m not understandig what to put. Also I have to say that my blog y the root folder and I don’t need to specify a folder as you specify here.
Thanks man!!! Cheers!
[Translate]
[Reply]
Nate Reply:
November 26th, 2009 at 1:08 pm
@Alejandro-
You can temporarily do
var_dump($_SERVER);
to see all of the different global server things available. you want to pick the one that takes you from the root directory / to /www
Let me know if you have any other problems.
[Translate]
[Reply]
#2 by Onore on December 2, 2009 - 8:49 am
Quote
Where is i can view a demo or work site..there wordpress+zenphoto works together?
Sorry for my english =)
[Translate]
[Reply]
nate Reply:
December 6th, 2009 at 3:16 pm
I don’t have an example yet, but am hoping to get a gallery set up here soon.
[Translate]
[Reply]
#3 by Stuart on December 20, 2009 - 11:32 am
Quote
Odd. After reading this, integration sounds complicated.
If we assume you already have a zenphoto gallery with albums, just use “ZenphotoPress” in wordpress.
First, create a wordpress site.
Then install “ZenphotoPress” using the plugin menu.
Once installed, you need to go to the “ZenphotoPress” setup (under “Settings”) to point to your Zenphoto gallery.
Then all you need to do is to edit / create a post.
At the top of the edit screen, you’ll see a “ZenphotoPress” button. If you press this button, you select the album, the thumbnail you want to use on the page, and so on.
You will need to know a little HTML to fine-tune your view. But, that’s all there is to it.
Here’s my gallery. I used “ZenphotoPress”. Take a look to see if this is what you want to do:
http://www.valaddsoft.com/PhotoGallery/
PS – If you want to protect your albums using passwords, create the wordpress link first, then add a password to the zenphoto album. That’s what I did, and you can see some albums are password protected.
Have fun! ;-)
[Translate]
[Reply]
Nate Reply:
December 23rd, 2009 at 7:04 pm
Sounds Easy, I will try it out. Thanks Stuart.
[Translate]
[Reply]
Stuart Reply:
January 2nd, 2010 at 3:20 pm
Nate,
No problem. Let me know if you have questions. It’s easy, but there are some trial-and-error loops I had to go through to set this up. Mostly HTML stuff to tweak the look/feel of my wordpress frontend. I also had to play with the password stuff, before I found a way to make it work inside zenphoto.
[Translate]
[Reply]
#4 by nate on December 25, 2009 - 8:49 pm
Quote
I am now using the kpicasa gallery plugin with the google picasa photo software, which I have found is everything I wanted in a gallery. The problem with the previous zenphoto solution is that is doesn’t place the whole gallery into a page, which is what I wanted. The problem with my solution is that I didn’t have a completely static wordpress theme (I liked to change things) and so I didn’t want to have to manage the zenphoto theme to look like a changing wordpress one. The blog post solution will work if you have a theme that you don’t change very often, or have a way of automatically updating it based on database stored css or something.
[Translate]
[Reply]
Stuart Reply:
January 5th, 2010 at 6:36 pm
Interesting. I’ll take a look at it.
Thanks for telling us about kpicassa.
[Translate]
[Reply]