WordPress.org

Ready to get started?Download WordPress

Forums

File Gallery
Different sized thumbs on recent post (4 posts)

  1. Raw-m
    Member
    Posted 3 years ago #

    Is there a way to use the "medium" sized thumbnails on the most recent post and the "thumb" for all the others? Reading the docs, I had hoped something like this would work, but it has no effect:

    query_posts('showposts=1');
    	if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<div id="recent-gallery">
    
    		<h2 class="recent-head">Recent</h2>
    		<div class="entry">
    			<?php
    				file_gallery_shortcode(array('size'=>'medium'));
    				the_content();
    			?>
    
    		</div>
    	</div>

    My php skills aren't that great so any pointers would be greatly appreciated!

    Many thanks.

    http://wordpress.org/extend/plugins/file-gallery/

  2. Aesqe
    Member
    Plugin Author

    Posted 3 years ago #

    hey Raw-m :)

    file_gallery_shortcode function only returns values, it does not echo (print) them. all you have to do is add 'echo' in front of it, like this:

    query_posts('showposts=1');
    	if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<div id="recent-gallery">
    
    		<h2 class="recent-head">Recent</h2>
    		<div class="entry">
    			<?php
    				echo file_gallery_shortcode(array('size'=>'medium'));
    				the_content();
    			?>
    
    		</div>
    	</div>
  3. Raw-m
    Member
    Posted 3 years ago #

    Hi Aesqe

    Great stuff, nearly there...!

    Is there a way to get the "echo file_gallery_shortcode(array('size'=>'medium'))" into the_content?

    Your example is basically echoing the gallery twice, first time ("echo file_gallery_shortcode(array('size'=>'medium'))") just the gallery with the gallery size I'm after, the second ("the_content()") using the thumb default size with post text. Ideally, I want the size=medium with my text from the post. Do I somehow need to filter out the gallery embeded in the_content to get what I need? Hope that makes sense!!

  4. Aesqe
    Member
    Plugin Author

    Posted 3 years ago #

    Raw-m, please try File Gallery 1.6.5.1 - it's still not a public release (it's in the trunk as the development version), but you can download it from here: http://downloads.wordpress.org/plugin/file-gallery.zip

    then, after you install it, add this code before the_content();, replacing echo file_gallery_shortcode(array('size'=>'medium')); with it:

    file_gallery_overrides(array('size'=>'medium'));

    this will override the arguments within the gallery shortcode for this post.

    let me know if it works ok for you :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic