Built-in Gallery Function Limitations?
-
I haven’t found a gallery plugin that I feel comfortable using for a responsive solution, they all seem to suck on mobile. So I have tried to customise and style the built-in gallery and combine it with a gallery custom post type. Which works providing –
a) you upload images directly into and specifically for use in one particular gallery
– if they are attached elsewhere, the gallery thumb links to the attachment page, but won’t link it to the other images on the same gallery using a navigation function, nor will it link back to the gallery but back to the original attachment page or post instead elsewhere within the website.b) caution if adding new images to an existing gallery
– won’t necessarily link the images together when you click through from the thumbnail and then use previous_image_link or next_image_link. The new images will go back to the gallery but not link to next or previous images contained within the gallery.If the above is correct (a) I can work around, but (b) does need sorting if it’s possible.
Here is the code used to navigate between images via the attachment pages (thumbnails are linked to attachment) I’ve ‘borrowed’ from the TwentyFifteen theme. –<div id="gallery-navigation" class="navigation image-navigation golf-link"> <?php // close button back to gallery thumbnails. the_post_navigation( array( 'prev_text' => _x( '<span>Close</span>', 'Parent post link', 'dvgc-responsive' ), ) ); ?> <div id="image-navigation" class="navigation image-navigation golf-link"> <div class="nav-previous-img"> <?php previous_image_link( false, __( '≪ Prev', 'dvgc-responsive' ) ); ?> </div> <div class="nav-next-img"> <?php next_image_link( false, __( 'Next ≫', 'dvgc-responsive' ) ); ?> </div> </div> </div>
I am also using the new RICG Responsive Images plugin with the gallery but I don’t think that makes any difference to my problem with the navigation. But just incase this is included just before the above code –
<?php //get image alt $image_attributes = wp_prepare_attachment_for_js( get_post_thumbnail_id( get_the_ID() ), 'full' ); $alt = $image_attributes['alt']; $url = $image_attributes['url']; $id = $image_attributes['id']; //pass image url and ID through responsive image plugin echo "<img alt='$alt' src='$url' "; echo tevkori_get_src_sizes( $id, 'large' ); echo "/>"; ?>
Can anyone help?
- The topic ‘Built-in Gallery Function Limitations?’ is closed to new replies.