Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter Mike Matenkosky

    (@hikinmike)

    On another site, I was using this in my non-MLA gallery:

    [gallery orderby="ASC" numberposts="20" columns="5"]
    
    <!--nextpage-->
    
    [gallery orderby="ASC" numberposts="20" offset="20" columns="5"]

    So I modified it like this. It seems to work. Is there a better way, or is this it? Obviously I’ll had to add more nextpage when I need to.

    [mla_gallery orderby="ASC" posts_per_page=20 columns="5" attachment_category="att-category-landscape"]
    
    <!--nextpage-->
    
    [mla_gallery orderby="ASC" posts_per_page=20 offset="20" columns="5" attachment_category="att-category-landscape"]
    Plugin Author David Lingren

    (@dglingren)

    Good work! As you’ve discovered, the [mla_gallery] shortcode supports all the pagination parameters documented in the WP_Query Class Reference.

    On the Settings/Media Library Assistant Documentation tab you can also read “You can also pass “paged=current” to suppress the “nopaging” default; “current” will be replaced by the appropriate value (get_query_var(‘paged’)).”

    Depending on the theme you’re using you might find more support for pagination controls (Next, Previous, etc.), but you’ve got the basic idea.

    Thanks for the update and for your interest in the plugin. If you have any other questions or problems, let me know. In the interim, I’ll mark this question Resolved; you can open it back up if you need more help.

    Thread Starter Mike Matenkosky

    (@hikinmike)

    One more question related to this. For some background, I’m using one of the http://www.themehybrid.com child themes…highly modified for my photo site. I’m not currently using any lightboxes, so my images display the default ‘attachment-image.php’. When I view one image, I see ALL of my thumbnail images below. I would like to only view the thumbnails for on particular gallery (attachment_category). Here is a link to my testing site.

    MLA San Luis Gallery

    I only have 4 images, but when you click on a thumbnail, all of the images that I uploaded to the Media Library (thumnails) show up.

    Is there a way to only display THAT Gallery/Category?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for sharing the link to your site – your images are beautiful!

    It looks like the tumbnail images at the bottom of your single-image pages are created by some sort of gallery shortcode or logic in the theme you’re using (or perhaps another plugin). To be sure, I’d have to look at the source code that generates the page – can you share that with me?

    I have been able to enhance the [mla_gallery] shortcode to work with the Photonic plugin, which also displays galleries and slide shows. It’s possible I can do something with the theme and plugins you are using, but I need more information to do some investigation.

    I had a look at the Theme Hybrid web site. I don’t have access to the documentation at their site because I am not “an exclusive club member”. They have lots of themes (and plugins); which one(s) are you using? If your theme is “highly modified” I may need access to your specific source code.

    If you would rather pursue this offline, send me your e-mail address and I will give you an e-mail address you can use to e-mail me more information. Go to the “Contact Us” page at our web site:

    Fair Trade Judaica/Contact Us

    David

    Thread Starter Mike Matenkosky

    (@hikinmike)

    It started out as the ‘My Life’ theme. It was his personal blog and he used it as the demo on his themhybrid site. He recently changed it, but he didn’t update the old theme on the demo. Its more modified in colors, adding slideshow etc, then adding functions. The gallery isn’t a plugin, this is just how most of the themes run. Here is the ‘attachment-image.php’ file from my Child theme:

    I added the Pagination.

    <?php
    /**
     * My own "Tuolumne Meadows" Attachment Template
     *  I added 'prev-next' class and 'comment-template' class, schema.org/Photograph.
     *
     * @package MyLife
     * @subpackage Template
     * @since 0.1.0
     * @author Justin Tadlock <justin@justintadlock.com>
     * @copyright Copyright (c) 2011, Justin Tadlock
     * @link http://themehybrid.com/themes/my-life
     * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     */
    
    get_header(); // Loads the header.php template. ?>
    
    	<?php do_atomic( 'before_content' ); // my-life_before_content ?>
    
    	<div id="content">
    	<?php dynamic_sidebar('papt-image-sidebar'); //Custom Sidebar for  PhotoPress ?>
    		<?php do_atomic( 'open_content' ); // my-life_open_content ?>
    
    		<div class="hfeed">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php do_atomic( 'before_entry' ); // my-life_before_entry ?>
    
    					<div itemscope itemtype="http://schema.org/Photograph" id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
    
    						<?php do_atomic( 'open_entry' ); // my-life_open_entry ?>
    
    						<span itemprop="name"><?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?></span>
    
    						<div class="entry-content">
    							<?php if ( has_excerpt() ) {
    								$src = wp_get_attachment_image_src( get_the_ID(), 'full' );
    								echo do_shortcode( '[caption align="aligncenter" width="' . esc_attr( $src[1] ) . '" caption="' . get_the_excerpt() . '"]' . wp_get_attachment_image( get_the_ID(), 'full', false  ) . '[/caption]' );
    								}
    								else {
    								echo wp_get_attachment_image( get_the_ID(), 'full', false, array( 'class' => 'aligncenter' ) ) ;
    								} ?>
    							<div itemprop="description" class="attachment-image-desc">
    								<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'my-life' ) ); ?>
    							</div>
    							<div class="prev-next">
    								<div class="prev"><?php previous_image_link( false, '◄ Previous' ); ?></div>
    								<div class="next"><?php next_image_link( false, 'Next ►' ); ?></div>
    							</div>
    							<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'my-life' ), 'after' => '</p>' ) ); ?>
    							<?php $gallery = do_shortcode( sprintf( '[gallery id="%1$s" exclude="%2$s" columns="10" numberposts="20" orderby="ASC"]', $post->post_parent, get_the_ID() ) ); ?>
    							<?php if ( !empty( $gallery ) ) { ?>
    								<div class="image-gallery">
    									<h3><?php _e( 'Gallery', 'my-life' ); ?></h3>
    									<?php echo $gallery; ?>
    								</div>
    							<?php } ?>
    						</div><!-- .entry-content -->
    
    						<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( 'By [entry-author] on <abbr class="published updated" [entry-published] [entry-edit-link before="| "]', 'my-life' ) . '</abbr></div>' ); ?>
    
    						<?php do_atomic( 'close_entry' ); // my-life_close_entry ?>
    
    					</div><!-- .hentry -->
    
    					<?php do_atomic( 'after_entry' ); // my-life_after_entry ?> 
    
    					<?php do_atomic( 'after_singular' ); // my-life_after_singular ?> 
    
    					<div class="comment-template">
    					<?php comments_template( '/comments.php', true ); // Loads the comments.php template. ?>
    					</div>
    
    				<?php endwhile; ?>
    
    			<?php endif; ?>
    
    		</div><!-- .hfeed -->
    
    		<?php do_atomic( 'close_content' ); // my-life_close_content ?>
    
    		<?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
    
    	</div><!-- #content -->
    
    <?php do_atomic( 'after_content' ); // my-life_after_content ?>
    
    <?php get_footer(); // Loads the footer.php template. ?>

    Thought I add this….Only the unattached images display on the bottom gallery regardless of category/tag.

    Plugin Author David Lingren

    (@dglingren)

    I think we’re in luck – thanks for posting your source code.

    The key source code statement is this one:

    <?php $gallery = do_shortcode( sprintf( '[gallery id="%1$s" exclude="%2$s" columns="10" numberposts="20" orderby="ASC"]', $post->post_parent, get_the_ID() ) ); ?>

    Let’s take this shortcode apart. The id= parameter restricts the gallery to items attached to the attachment’s parent post/page. The exclude= parameter excludes the attachment itself. The orderby=ASC parameter is actually an error; perhaps you meant order=ASC. The orderby=ASC will be ignored and you get the default order, which is by menu_order and then post ID in ascending order.

    This statement uses the WordPress [gallery] shortcode to compose the gallery. You can change it to use [mla_gallery] and add the attachment_category="att-category-landscape" parameter to select just the images you want. You can also add orderby=ID order=ASC or whatever sort parameters you need.

    You might have to adjust some of the class, id and CSS attributes to get the gallery formatted properly, but the selection part should be straightforward.

    Let me know how it goes and if you need any more assistance. Thanks again for your interest in the plugin.

    Thread Starter Mike Matenkosky

    (@hikinmike)

    The orderby=ASC came from the Parent theme. He used orderby=RAND, so I changed it to ASC.

    Changing the shortcode from this

    <?php $gallery = do_shortcode( sprintf( ‘[gallery id="%1$s" exclude="%2$s" columns="10" numberposts="20" orderby="ASC"]‘, $post->post_parent, get_the_ID() ) ); ?>

    to this doesn’t work. It obviously removed the gallery thumbnails.

    <?php $gallery = do_shortcode( sprintf( ‘[mla_gallery id=”%1$s” exclude=”%2$s” columns=”10″ numberposts=”20″ orderby=”ASC”]’, $post->post_parent, get_the_ID() ) ); ?>

    Plugin Author David Lingren

    (@dglingren)

    With respect to the “orderby” parameter, I can tell you that “orderby=ASC” does not work, and “orderby=RAND” does not work either. I have just re-tested both of these values, and both are rejected by the WordPress [gallery] validation logic.

    However, there is another explanation which isn’t good news. I suspect that your theme is intercepting the WordPress [gallery] shortode and substituting its own implementation. There is this bit of code early in the WordPress [gallery] function:

    // Allow plugins/themes to override the default gallery template.
    $output = apply_filters('post_gallery', '', $attr);
    if ( $output != '' )
    	return $output;

    If your theme hooks this filter, then all bets are off.

    I’m not sure what you mean by “It obviously removed the gallery thumbnails”, but the HTML tags, class and id attributes and CSS styles in the gallery portion of the page on your test site are quite different than those generated by the WordPress [gallery] shortcode. This is another clue that a different gallery generation function may be generating the gallery.

    When you switch to [mla_gallery] does anything appear? You should see something, even if it’s not formatted properly. On a test site, you can try adding “mla_debug=true” to your [mla_gallery] shortcode. This will put out a lot of ugly but informative information. If you can do that, post it here or send it to me and I’ll have a look.

    If you have a formatting problem, you can probably use the MLA custom style and markup templates feature to generate a gallery that matches your theme. If it’s something else, looking at the debug output might give me more information to help you out.

    Having a look at your theme source code would also be useful. You are welcome to ZIP it up and send it to me if you feel comfortable with that.

    Thanks for sticking with with this; I hope we can resolve it for you.

    David

    Thread Starter Mike Matenkosky

    (@hikinmike)

    When I changed this:

    <?php $gallery = do_shortcode( sprintf( ‘[mla_gallery id=”%1$s” exclude=”%2$s” columns=”10″ numberposts=”20″ orderby=”ASC”]’, $post->post_parent, get_the_ID() ) ); ?>

    The gallery thumbnails disappeared. Everything else was as it should.

    Here’s the results to the debug:

    mla_debug WHERE filter = ' AND ( wp_term_relationships.term_taxonomy_id IN (488) AND tt1.term_taxonomy_id IN (491) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))'
    
    mla_debug modified WHERE filter = ' AND ( wp_term_relationships.term_taxonomy_id IN (488) AND tt1.term_taxonomy_id IN (491) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))'
    
    mla_debug query = array ( 'attachment_category' => 'att-category-landscape', 'attachment_tag' => 'att-tag-sanluisnwr', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'nopaging' => true, 'ignore_sticky_posts' => true, 'no_found_rows' => true, )
    
    mla_debug request = 'SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) LEFT JOIN wp_posts AS p2 ON (wp_posts.post_parent = p2.ID) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (488) AND tt1.term_taxonomy_id IN (491) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC '
    
    mla_debug query_vars = array ( 'attachment_category' => 'att-category-landscape', 'attachment_tag' => 'att-tag-sanluisnwr', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'nopaging' => true, 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'error' => '', 'm' => 0, 'p' => 0, 'post_parent' => '', 'subpost' => '', 'subpost_id' => '', 'attachment' => '', 'attachment_id' => 0, 'name' => '', 'static' => '', 'pagename' => '', 'page_id' => 0, 'second' => '', 'minute' => '', 'hour' => '', 'day' => 0, 'monthnum' => 0, 'year' => 0, 'w' => 0, 'category_name' => '', 'tag' => '', 'cat' => '', 'tag_id' => '', 'author_name' => '', 'feed' => '', 'tb' => '', 'paged' => 0, 'comments_popup' => '', 'meta_key' => '', 'meta_value' => '', 'preview' => '', 's' => '', 'sentence' => '', 'fields' => '', 'menu_order' => '', 'category__in' => array ( ), 'category__not_in' => array ( ), 'category__and' => array ( ), 'post__in' => array ( ), 'post__not_in' => array ( ), 'tag__in' => array ( ), 'tag__not_in' => array ( ), 'tag__and' => array ( ), 'tag_slug__in' => array ( ), 'tag_slug__and' => array ( ), 'suppress_filters' => false, 'cache_results' => true, 'update_post_term_cache' => true, 'update_post_meta_cache' => true, 'posts_per_page' => 10, 'comments_per_page' => '50', 'taxonomy' => 'attachment_category', 'term' => 'att-category-landscape', )

    You can download the Parent Theme here: http://themehybrid.com/themes/my-life

    I appreciate the help trying to figure this out. Honestly, the website that I’m currently using (www.iimagesinthebackcountry.com) works fine. I was thinking of using MLA because I liked some of the features and to maybe make it easier in the long run to add content.

    Plugin Author David Lingren

    (@dglingren)

    Mike,

    Thanks for the additional information and the link to your theme. I will try installing the theme and running more tests.

    The debug information you posted is great, but it doesn’t match the do_shortcode statement that’s just above it in your post. I can see attachment_category and attachment_tag parameters in the debug output but not in the statement.

    Have you tried the statement without any taxonomy parameters, and with just one or the other of the two taxonomy parameters? The two taxonomy parameters are joined by “AND”, so an image would have to satisfy both to be displayed.

    I’ll continue my investigation.

    Thread Starter Mike Matenkosky

    (@hikinmike)

    Unfortunately I don’t know what I’m doing, so If I didn’t do the debug correctly, please tell me exactly what to do.

    I tried removing the taxonomy parameters, but that didn’t work.

    I’m beginning to realize that the MLA isn’t going to work in my themes and I will have to do my galleries like I’ve done in the past. I do hope this isn’t the case.

    Plugin Author David Lingren

    (@dglingren)

    Mike,

    You did the debug correctly, it just didn’t match the example statement.

    I have set up a test site with the “My Life” master and child themes. I have reproduced the “gallery disappears” problem you are having, so I can get to the bottom of what’s happening without any further action on your part. I will keep you posted on my progress.

    Thanks for your patience and your cooperation – hang in there!

    David

    Thread Starter Mike Matenkosky

    (@hikinmike)

    Glad to hear that it wasn’t me.

    Really appreciate all of your help David!

    Plugin Author David Lingren

    (@dglingren)

    Mike,

    I’ve made some progress and discovered that there is a subtle difference in how the “id=” parameter is handled in [mla_gallery] Vs the standard WordPress [gallery] shortcode. It happens with “unattached” images, i.e., images with post_parent=0. I’ve decided it’s a bug in [mla_gallery]; thanks for uncovering it!

    I have also discovered that [mla_gallery] does not process the numberposts parameter, which is not documented for the WP_Query class but the get_posts documentation says “Note: ‘numberposts’ and ‘posts_per_page’ can be used interchangeably.” This isn’t exactly a bug but I’ll add support for numberposts in my next release; thanks again!

    If I’m right, adding post_parent=all to your shortcode should make the gallery reappear.

    When you have time, try this statement:

    <?php $gallery = do_shortcode( sprintf( '[mla_gallery post_parent=all id="%1$s" exclude="%2$s" columns="10" posts_per_page="20" orderby="ASC"]', $post->post_parent, get_the_ID() ) ); ?>

    That should produce a gallery similar to the one [gallery] gave you. Leave the attachment_category and attachment_tag parameters out for your first test. If the first test works, add the attachment_category and attachment_tag parameters back in (one at a time, perhaps) and see what happens.

    In my test site, the post_parent=all parameter fixed the id= problem. However, in my site adding the attachment_category and attachment_tag parameters also fixed the problem, without adding post_parent=all. That means there might be some other problem with how [mla_gallery] is working on your site. I tried accessing your sandbox site today but it looks like you’re working on it – the “MLA San Luis Gallery” link you gave me no longer works.

    Let me know if these suggestions improve things. If the gallery is still completely missing, put in mla_debug=true and see if the first part of the debug output says “mla_debug empty gallery… “. If it does, then no images satisfy the query. If it doesn’t, then [mla_gallery] is generating a gallery that isn’t getting displayed for some other reason. Give me a link to the resulting page and I’ll have a closer look.

    Thanks for your ongoing help.

    David

    Plugin Author David Lingren

    (@dglingren)

    Further investigation reveals that the “My Life” theme does indeed contain a post_gallery filter which replaces the standard WordPress [gallery] shortcode implementation with an alternative function, cleaner_gallery (sound familiar?).

    This alternative implementation does not add inline CSS styles to the page and may generate different HTML markup, e.g., class attributes, that the theme requires for proper gallery display.

    I’m confident that an MLA custom style and markup template can be defined to match the cleaner_gallery output. I will see what I can do…

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Pagination’ is closed to new replies.