This is a little hack to enable you to display Random Photos from your Gallery installation
Open up your block-random.php file (which should be included with the Gallery dist. If not, search the Gallery Forums for a copy, or download from this URI), in block-random.php add;
$GALLERY_BASEDIR = "/abolute/path/to/your/gallery/";
Including the back slash. Be sure to add this just before the Hack Prevention code.
Next, modify your WordPress template to include the default PHP output buffering as;
/* begin output buffering */
/* Don't remove this line. */
you can see, I have ensured that ; is the first function called when the page loads.
Finally, you need to setup the template to send all the headers so, add;
At the end of your page.
Now, the most important thing. FTP your block-random.php script into your WordPress folder, and simply use a PHP include. I have used it on my site as;
< ?php include(ABSPATH . 'block-random.php'); ?>
There you have it. A Random photo block for your WordPress Blog.
- The topic ‘Add the Gallery Random Block to WP’ is closed to new replies.