2012-05-06, 05:48:07
andyash Wrote:I want to show a group of 3-4 random photos in the sidebar linked to a single gallery. (kind of like sidebar flickr photos in wordpress blogs)
Can it be done, and if yes, how?
To add links to a gallery, see here.
But it will only show one thumbnail.
You could add 3 links, but if the thumbnails shown are random, some could show the same picture.
Or you can add 3 links with specific different thumbnails, but then it is not random.
Of course you can get three random numbers yourself and display 3 links (not tested!):
Code:
<?php
$gallery = return_i18n_gallery('my-gallery-name');
$num =count($gallery['items']);
$pics = array();
while (count($pics) < 3) {
$i = rand(0,$num-1);
if (!in_array($i,$pics)) {
$pics[] = $i;
get_i18n_gallery_link('my-gallery-name', array('url'=>'my-gallery-slug', 'thumb'=>$i)); ?>
}
}
?>