Support » Plugins » Gallery 2 and WordPress

  • Short: does anyone know of or have any tips, tricks or guides to integrating WP 1.5 and Gallery 2? And for starters, I just mean using WP as a base and wrapping it around G2. Effectively, it may be the other way around, but I just want to emphasize that I’m not talking about just posting G2 images in WP posts.

    Long: I’ve been fiddling with WP 1.5 for a while and have decided to move my own webpage and a few friends’ to a WP-based system. I’m quite adept with PHP and such, but do not have the full picture yet, especially regarding the new theming system and the plugin API. I’ve also used G2 for some time, and am helping out with a G2 RSS plugin at the moment, so I know a bit about it’s API.

    However, I’ve not yet found a good way to embed one in the other yet, not even in terms of just using G2’s template system (and Smarty engine) to embed WP so the site looks clean and tight.

    Obviously, the best idea would be to create an actual WP plugin for G2, allowing for the functionality of the WP-Gallery plugin and sharing WP and G2 categories and so forth. Unfortunately, I don’t have the resources at the moment to actually do this.

    So right now, I’m just trying to figure out the best way to integrate the two without messing too much with the actual code, and adhering if at all possible to the API functionality of both WP and G2. I believe that using G2’s global.tpl in a local-directory is the best approach, but I’m not quite sure which of WP’s files I need to include, and which of the API functions I need to call in order to get the necessary data pulled out for the resulting HTML.

    Any pointers?


Viewing 10 replies - 1 through 10 (of 10 total)
  • It might be best to hold off on trying to get G2 working with WordPress. Since it’s still in alpha stages (G2, not WP), there’s a good chance that the database is going to be changing around a lot. Whatever work you do could be broken from one alpha to the next.

    I’m waiting for it to hit beta before I mess around with it, personally. Of course, if you know that the database structure wont be changing (since you’re helping out on the project) I’ll poke around and report my findings. 🙂 Lemmie know if you can give a solid answer on the database.

    Hi JuneBleeds, thanks for your reply.
    Unfortunately, since I’m only a peripheral developer and have no impact or influence on the work on the official part of G2, I can give no such guarantees.

    However, I can tell you that G2 is nothing like G1 in that respect. It uses a top-layer database API which allows, say, plugin devs to use an abstract syntax for direct database access to G2 (I assume that is what you mean) which doesn’t change, regardless of how the actual table structure looks. I’m fairly confident that the API interface to the G2 database will stick to it’s current form, so this shouldn’t be an issue.

    I understand how alpha releases of software can seem intimidating, but Gallery 2 in it’s current form is quite usable and is nothing like more traditional alpha-phase software, in my opinion.

    In short, G2 is not G1, it’s much more flexible. It’s theming and template system can be a bit of a mouthful, though, and that’s why I’ve asked around here before I attempt to do this from scratch, on my own. I’d be happy to collaborate on this little project, though. 😉


    This sounds interesting, I had a look at integrating G2 into a page in WP1.5 but had no luck. Personally I’m not bothered about categories and user databases though the latter would be nice. Mainly I’d like to just be able to get the gallery items in my WP layout, preferably using the same style sheet/layout so modifications to WP would be reflected in G2.

    Let us know how you get on.

    Well … I’ve not come very far. No matter how I attempt to get access to WP’s API, I keep bumping into the same error:

    Fatal error: Call to a member function on a non-object in /home/test/www/wp-includes/functions.php on line 1068

    In this case, I used the Smarty function include_php to include wp-blog-header.php from within Gallery’s global.tpl.

    I believe the problem lies in how the $wpdb class is instantiated and then globalized in wp-includes/wp-db.php but I haven’t been able to figure out how to get around this.

    Where can I see the new G2? I too am trying to find someone to help me with this kind of integration.



    Well, if you mean a demo setup that you can play with, I’m not quite sure. But there are some sample galleries here:

    Hi! As a member of the Gallery team, I would like to invite all of you over to the Gallery website. Not that I want to steal people away from here, but I believe that it would be a better better for everyone looking to integrate G2 and WordPress to talk directly to the Gallery 2 developers. If there are any changes that needs to be done to G2 to enable it to embed into WordPress, I’m sure the devs are more than interested to have a look at it.

    I would also like to note that Gallery 2 has gone into it’s first Beta release now, and the db structure should be stable from now and until release. Now would be the best time to get started on making an integration happen.

    G2 and WP make a great pair. It’s terrific that someone like hobbel is involved in the development of both (ok, dev of one, user of another). As at the time of this post I am using both on my (in-redesign) site.

    I for one would love any sort of integration between G2 and WordPress even if it were only a way to integrate the look and feel rather than the who admin/user base. I’ll keep my eyes peeled for any news on this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Gallery 2 and WordPress’ is closed to new replies.