Tweak attachment to work with [gallery] shortcode

This differs from the [gallery ids=“xxx,xxx”] shortcode because rather
than linking by ids in the tag the gallery attachments are linked by
the parent_id field within the export.  Fun!