WordPress.org

Ready to get started?Download WordPress

Forums

Portfolio Slideshow
exclude the get_thumbnail image from the gallery? (11 posts)

  1. forcetwelve
    Member
    Posted 3 years ago #

    hi - thanks so much for this wonderful plugin. finally someone has built a great, simple gallery for us to use!

    i have one question, how can i exclude the get_thumbnail or the featured image being included in the gallery?

    i am currently calling the gallery in my theme like this:
    <?php echo do_shortcode('[portfolio_slideshow]');?>
    and would love if i could exclude the thumbnail somehow.

    thanks again.

    http://wordpress.org/extend/plugins/portfolio-slideshow/

  2. Dalton
    Member
    Plugin Contributor

    Posted 3 years ago #

    Hi there,
    Exclude is an option in the shortcode. It's documented in the installation section of the plugin page, take a look and you'll find it: http://wordpress.org/extend/plugins/portfolio-slideshow/installation/

    Cheers,
    Dalton

  3. forcetwelve
    Member
    Posted 3 years ago #

    thanks for coming back to me dalton.

    what i am trying to do is somehow remove the get_thumbnail image though without having to exclude it's unique image tag each time.

    someone has written a function here:

    but i can't seem to get it working with your plugin. maybe you would know how i could edit that code to make it work? many thanks.

  4. Dalton
    Member
    Plugin Contributor

    Posted 3 years ago #

    Yup, it should be very close to the same thing:

    <?php  $id = get_post_thumbnail_id(get_the_ID()); // gets the post thumbnail ID ?>
    <?php echo do_shortcode("[portfolio_slideshow exclude={$id}]"); // insert the gallery without the thumbnail ?>

    I haven't tested it, but does that work for you?

    Dalton

  5. forcetwelve
    Member
    Posted 3 years ago #

    hi again - thx for responding.

    that works, although it pulls in all the images from the media library - not just from the post.

    for instance, i have 16 images in my media library, and the gallery shows all 16, not just the 4 for that post.

    any ideas why?

  6. Dalton
    Member
    Plugin Contributor

    Posted 3 years ago #

    Whoa! No I don't have any idea why it would do that! I have used the do_shortcode function before and not had that problem. It may have something to do with where in your template you are using the function - do you have any additional queries in there? Are you running any plugins that might modify the output of the original query?

  7. forcetwelve
    Member
    Posted 3 years ago #

    here's my code on the single.php - this is where the gallery is.

    <?php get_header(); ?>
    
    	<?php while(have_posts()) : the_post(); ?>
    
    		<div class="post">
    
    			<div class="left">
    				<h2><?php the_title(); ?></h2>
    				<?php the_content(); ?>
    				<div class="clear"></div>
    			</div><!-- left -->
    
    			<div class="right">
    
    		<?php  $id = get_post_thumbnail_id(get_the_ID()); // gets the post thumbnail ID ?>
    		<?php echo do_shortcode("[portfolio_slideshow exclude={$id}]"); // insert the gallery without the thumbnail ?>
    
    			</div>
    
    		</div> <!-- post -->
    
    	<?php endwhile; ?>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
  8. forcetwelve
    Member
    Posted 3 years ago #

    does that make sense?

  9. himanshu88
    Member
    Posted 3 years ago #

    Cool this works
    i did a weeks research and didnt get anything
    experimented your code and got it specific to my needs and working with custom fields

    1. My aim was to show gallery images ,
      exclude images from specific custom fields ( custom field template plugin)
      auto link to file
      auto addition of gallery if post has images
      showing gallery only in specific category

    take my contribution

    <?php if(!in_category(array(1,40))) { ?>
    <?php $logo = get_post_meta($post->ID, 'logo', true); ?>
    <?php $thumbnail_id = get_post_meta($post->ID, 'thumbnail_id', true); ?>
    <?php echo do_shortcode("[gallery columns=4 exclude={$logo},{$thumbnail_id}]"); ?>
    <?php }; ?>

  10. himanshu88
    Member
    Posted 3 years ago #

    @Dalton Rooney thanks man , Cheers

  11. jvandelaar
    Member
    Posted 3 years ago #

    I'm confirming the 2 lines of code that @Dalton Rooney posting indeed works! Thanks heaps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic