I recently installed WPG2 and Gallery2 to my block to manage the photos and images which are related to my blog entries and generally to store the photos taken by me. I found WPG2 quite good, but it lacked a feature I missed: To display random images from an album which is related to a specified blog entry. What I mean, that I take a bunch of photos, import them into my gallery2 installation and then write a blog entry about them. This patch allows to add a “related-gallery” -custom field to the blog article, which the Sidebar Grid Block then picks up and it displays random images from that album.
- Install WPG2 (I’m using
- Apply the patch: WPG2 patch against WPG 126.96.36.199 to add support for Related Gallery to Sidebar Grid Block
- Add the Sidebar Grid Block to your layout from Presentation -> Widgets
- Configure the Sidebar Grid Block from WPG2 -> Sidebar Grid Block
- Upload some photos to your Gallery2 installation
- Obtain the album id where you uploaded your images. The album id can be found from the URL of the album. This is an example from my album: “http://blog.juhonkoti.net/gallery2/main.php?g2_itemId=37”. In this url the album id is 37. Obtain this numeric id.
- Write a blog entry and add a custom field from the bottom: key is related-gallery and value is the id you just obtained from the step 6.
- All done, go and see the results.
Known problems and limitations:
- Currently you need to obtain the album id manually by looking the Gallery2 urls. This could be made easier by some kind of wizard.
- You need to use the Custom Fields -feature.
I’ve asked Ozgreg, the founder/programmer of the WPG2 project, if he could add my patch to the main trunk of WPG2. Let’s hear if he likes this :)