https://www.mediafire.com/?dsj1h8ispp2uq4a
or modify paginated-gallery.php
<?php
/*
Plugin Name: Paginated Gallery
Plugin URI: https://www.phil-barker.com/*page here*
Description: Adds pages to the wordpress gallery
Version: 0.2
Author: Phil Barker
Author URI: https://www.phil-barker.com
License: GPL2
*/
/* Copyright 2011 Phil Barker (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once(dirname(__FILE__) . '/options.php');
if (get_option('use_gallery_shortcode')) {
// Over-ride the standard gallery shortcode with our own
remove_shortcode('gallery');
add_shortcode('gallery', 'paginated_gallery');
} else {
add_shortcode('paginated-gallery', 'paginated_gallery');
}
function paginated_gallery($attr) {
/* Outputs a gallery of attachments with pagination
Most of this code is lifted from the standard gallery function - with a few tweeks for pagination
*/
$post = get_post();
static $instance = 0;
$instance++;
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) )
$attr['orderby'] = 'post__in';
$attr['include'] = $attr['ids'];
}
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ( $output != '' )
return $output;
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( !$attr['orderby'] )
unset( $attr['orderby'] );
}
extract(shortcode_atts(array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post ? $post->ID : 0,
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'thumbnail',
'include' => '',
'exclude' => '',
'link' => 'file'
), $attr, 'gallery'));
$id = intval($id);
if ( 'RAND' == $order )
$orderby = 'none';
if ( !empty($include) ) {
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif ( !empty($exclude) ) {
$attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
} else {
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
}
if ( empty($attachments) )
return '';
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment )
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$icontag = tag_escape($icontag);
$valid_tags = wp_kses_allowed_html( 'post' );
if ( ! isset( $valid_tags[ $itemtag ] ) )
$itemtag = 'dl';
if ( ! isset( $valid_tags[ $captiontag ] ) )
$captiontag = 'dd';
if ( ! isset( $valid_tags[ $icontag ] ) )
$icontag = 'dt';
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
$gallery_style = $gallery_div = '';
if ( apply_filters( 'use_default_gallery_style', true ) )
$gallery_style = "
<style type='text/css'>
#{$selector} {
margin: auto;
}
#{$selector} .gallery-item {
float: {$float};
margin-top: 10px;
text-align: center;
width: {$itemwidth}%;
}
#{$selector} img {
border: 2px solid #cfcfcf;
}
#{$selector} .gallery-caption {
margin-left: 0;
}
/* see gallery_shortcode() in wp-includes/media.php */
</style>";
$size_class = sanitize_html_class( $size );
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
$i = 0;
// Standard post output
$imagesPerPage = get_option('thumbnails_per_page');
// Work out how many pages we need and what page we are currently on
$imageCount = count($attachments);
$pageCount = ceil($imageCount / $imagesPerPage);
$currentPage = intval($_GET['galleryPage']);
if ( empty($currentPage) || $currentPage<=0 ) $currentPage=1;
$maxImage = $currentPage * $imagesPerPage;
$minImage = ($currentPage-1) * $imagesPerPage;
if ($pageCount > 1)
{
$page_link= get_permalink();
$page_link_perma= true;
if ( strpos($page_link, '?')!==false )
$page_link_perma= false;
$gplist= '<div class="gallery_pages_list">'.__('Pages').' ';
for ( $j=1; $j<= $pageCount; $j++)
{
if ( $j==$currentPage )
$gplist .= '[<strong class="current_gallery_page_num"> '.$j.' </strong>] ';
else
$gplist .= '[ <a href="'.$page_link. ( ($page_link_perma?'?':'&') ). 'galleryPage='.$j.'">'.$j.'</a> ] ';
}
$gplist .= '</div>';
}
else
$gplist= '';
$k = 0;
foreach ( $attachments as $id => $attachment ) {
if ($k >= $minImage && $k < $maxImage) {
if ( ! empty( $link ) && 'file' === $link )
$image_output = wp_get_attachment_link( $id, $size, false, false );
elseif ( ! empty( $link ) && 'none' === $link )
$image_output = wp_get_attachment_image( $id, $size, false );
else
$image_output = wp_get_attachment_link( $id, $size, true, false );
$image_meta = wp_get_attachment_metadata( $id );
$orientation = '';
if ( isset( $image_meta['height'], $image_meta['width'] ) )
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
<{$icontag} class='gallery-icon {$orientation}'>
$image_output
</{$icontag}>";
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "
<{$captiontag} class='wp-caption-text gallery-caption'>
" . wptexturize($attachment->post_excerpt) . "
</{$captiontag}>";
}
$output .= "</{$itemtag}>";
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= '<br style="clear: both" />';
}
$k++;
}
$output .= "
<br style='clear: both;' />$gplist
</div>\n";
return $output;
}
?>
]]>
Have not tested thoroughly, but seems to behave as title. e.g. inserting [gallery ids="185,184,183"] can result in a blank post if the images have been uploaded separately into media library.
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>This plugin does not work when you activate the Jetpack Carousel Gallery plugin.
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>When WP_DEBUG is enabled, activating this plugin causes any page with galleries to get some debug notices shown eg:
Notice: Undefined index: galleryPage in .../wp-content/plugins/paginated-gallery/paginated-gallery.php on line 104
Notice: Undefined index: id in .../wp-content/plugins/paginated-gallery/paginated-gallery.php on line 138
replace line 104
$currentPage = intval($_GET['galleryPage']);
with
if (isset($_GET ['galleryPage'])) {
$currentPage = intval($_GET ['galleryPage']);
}
replace line 138
$id = $options['id'];
with
$id = intval( isset ($options['id']) );
These changes seem to fix the notices
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>I put 12 thumbs per page and use gallery shortcode, but it shows 10 thumbs then nothing.
and the lightbox doesn’t work anymore with Cleaner gallery
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>Everythings works fine! First of all thanks for this usefull plugin.
1 important feature is missing, that is allowing us to show pagination at top of posts/pages instead of at bottom. Or to select to show at top, bottom & both.
I’m looking forward to hear from you developer. Thanks a lot. ??
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>Gallery pagination works but it breaks my lightbox feature.
https://www.ads-software.com/extend/plugins/paginated-gallery/
]]>