Add Description to image_gallery Views on Every Page

The image_gallery module which is bundled with the image module is a handy way of producing quick gallery-type content, and what is more, it integrates with views, and even better, comes with a pre-built view called (a little confusingly) image_gallery.

Gallery Without ThemingGallery With ThemingStrangely, this view does not output the taxonomy description field on every page, so a default gallery can look a little bare (left). With a small amount of theming, the description can be added resulting in a more complete and descriptive page (right). This description is shown on every page in the view.

Views TemplatesWe are going to need to edit a template file to provide the necessary theming; so first of all we need to determine which template file to create / edit. Go to admin/build/views/edit/image_gallery and click on Theme: Information. This will present you with a list of the templates being used, and a list of candidate templates. We need one of the Display output candidates - and will be using the first one which is named views-view--image-gallery.tpl.php which we now need to create.

You will need to change directory to the views subdirectory in your theme, and copy the existing template views-view.tpl.php to views-view--image-gallery.tpl.php

> cd sites/all/themes/beezee/views
> cp views-view.tpl.php views-view--image-gallery.tpl.php

You will then need to edit this views-view--image-gallery.tpl.php file to output the description on each page. It requires a few lines of code. Find the if ($rows) : section and replace with:
  <?php if ($rows): ?>
    <?php if ($view->result[0]->term_data_description): ?>
      <div class="description">
      <?php print check_markup($view->result[0]->term_data_description); ?>
      </div>
    <?php endif; ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

Views TemplatesYou now need to rescan the templates in the Views module so go back to admin/build/views/edit/image_gallery and click on Theme: Information again. Press Rescan template files and you should now see Views is picking up your new template.

Views Taxonomy DescriptionNext step is to include the taxonomy description in the view. You should still be at admin/build/views/edit/image_gallery and click on the plus sign by Fields, select Taxonomy under Groups and tick on Taxonomy: Term description. Click on Add and then Save.

Views Taxonomy DescriptionThis will take you to the next screen where you need to check Exclude from display, then Update and Save
You have now completed the tutorial and everything should be working just fine.