Add classes to template gallery thumbnails