Moving Description in NextGen Gallery
Monday, 1 February 2010
So, this is in response to Freaq’s question on the post Adding Title and Description to Nextgen Gallery Thumbnails. He had a site and he wanted to display the image description in the sidebar, not in the main embedded gallery.
To his credit, I couldn’t figure it out off the top of my head, so he hired my programming team to look into it, and he is kind enough to have given us permission to post the solution we came up with publicly so that if any of you need it it’s here…
Left sidebar page
wp-content\themes\THEME\l_sidebar.php
In left sidebar page we have changed div id from “desc” to “gallery_desc”.
Image Browser page
wp-content\plugins\nextgen-gallery\view\imagebrowser.php
In image browser page we added below mentioned code.
<div id="gal_title" style="display:none;"><b><?php echo ucfirst($image->alttext) ?></b></div>
<div id="gal_desc" style="display:none;"><p><?php echo ucfirst($image->description) ?></p></div>
<script language="javascript" type="text/javascript"> document.getElementById('gallery_desc').innerHTML = document.getElementById('gal_title').innerHTML+document.getElementById('gal_desc').innerHTML;
</script>
In place of
<div class="ngg-imagebrowser-desc"><h6><?php echo $image->description ?></h6></div>
Here we are putting the title & description in hidden div tags, and after loading the page, we allocate these values to left panel div tag having id “gallery_desc”.
