So I have implemented the random images onto my sidebar on m own (I didn't want to use the widget because I wanted it to just do one thing all the time and not give my client the capability to modify it.
So in my own sidebar.php I used the following code:
<?php if (function_exists("nggShowRandomRecent")) {echo nggShowRandomRecent('random',6,'home');} ?>
This works well and I utilize my own theme that looks like this:
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
<ul>
<?php //echo "images is ".print_r($images); ?>
<?php foreach ( $images as $image ) : ?>
<li><a href="<?php echo $image->pagelink; ?>" title="<?php echo $image->alttext ?>" ><?php if ( !$image->hidden ) { ?><img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" width="74" height="74" /><?php } ?></a></li>
<?php if ( $image->hidden ) continue; endforeach; ?>
</ul>
<?php endif; ?>
the <?php echo $image->pagelink; ?> works if you mod nggfunctions.php with this:
$picturelist[$key]->pagelink = get_permalink( $picture->pageid );
around line 358
and that allows me to show a link for the page associated to the gallery the images are associated with.
My only issue I have now is that if I go to a page that displays a gallery's images and I click to page 2 of the pagination then the nggShowRandomRecent will go to my theme and only print
I have print_r the $picturelist array that goes into nggCreateGallery and it looks fine,b ut it won't come out the other end of that function... the only thing I see different is that the url at top has ?nggpage=2 in it. And no matter is I unset($nggpage) before entering nggShowRandomRecent it breaks...
Any help would be great... if not then I understand *kicks a can down the block*
Oh and I commented out:
if ( $pageid == get_the_ID() || !is_home() )
if (!empty( $pid )) {
foreach ($picturelist as $picture) {
$picarray[] = $picture->pid;
}
$out = nggCreateImageBrowser($picarray);
return $out;
}
in nggShowRandomRecent because sometimes it would invoke it in nggpage=3 or so. Very weird issue and if I dig for another 3 days I might find it ;)