diff --git a/templates/player-gallery.php b/templates/player-gallery.php
index ca253023..413e6e00 100644
--- a/templates/player-gallery.php
+++ b/templates/player-gallery.php
@@ -115,10 +115,12 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
$groups = array( $group );
endif;
+ $j = 0;
+
foreach ( $groups as $group ):
$i = 0;
- echo '
';
+ echo '
';
if ( ! empty( $group->name ) ):
echo '
';
@@ -147,10 +149,16 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
endif; endforeach;
+ $j++;
+
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
echo '
';
}
+ if ( $show_all_players_link && ( 'position' !== $grouping || $j == count( $groups ) ) ) {
+ echo '
';
+ }
+
echo '
';
endforeach;
@@ -158,10 +166,6 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
echo '
';
}
-
- if ( $show_all_players_link ) {
- echo '
';
- }
echo "
\n";
?>
\ No newline at end of file