Congratulations on your progress (and on the site, which features beautiful work)!
Since you are working in a WordPress template file (image.php
) you have a lot of flexibility. To get the “tag name” of the current image you can try something like:
if ( isset( $_REQUEST['attachment_tag'] ) {
$term = get_term_by( 'slug', $_REQUEST['attachment_tag'], 'attachment_tag' );
$term_name = $term->name;
}
To get the “Gallery” links at each end of the chain you can try something like:
<span>
<?php
if ( isset( $_REQUEST['attachment_tag'] ) {
$term = get_term_by( 'slug', $_REQUEST['attachment_tag'], 'attachment_tag' );
$term_name = $term->name;
$gallery_link = sprintf( '<a href="%1$s/sculpture/?term_id=%2$s">%3$s</a>',
site_url(), $_REQUEST['attachment_tag'], $term_name );
} else {
$gallery_link = sprintf( '<a href="%1$s/sculpture/">All</a>',
site_url() );
}
$previous_link = do_shortcode('[mla_gallery mla_output="previous_link" mla_link_text="← MLA Previous Image" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');
if ( empty( $previous_link ) ) {
$previous_link = $gallery_link;
}
echo $previous_link;
?>
</span>
<span>
<?php
$next_link = do_shortcode('[mla_gallery mla_output="next_link" mla_link_text="MLA Next Image → {+query:term_taxonomy_id+}" attachment_category="mla-sculpture" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?p={+attachment_ID+}&attachment_tag={+request:attachment_tag+}"]');
if ( empty( $next_link ) ) {
$next_link = $gallery_link;
}
echo $next_link;
?>
</span>
I haven’t actually tested the above code, but you can easily find and fix any errors I’ve made. Let me know how it goes.