• Resolved tnoguchi

    (@tnoguchi)


    Hi,

    I’m developing a portfolio site for a client and am building a dynamically updated homepage gallery to highlight six recent projects. I’m using the_post_thumbnail to pull images and a query_posts call to pull the posts.

    When the user clicks on a thumbnail the post is displayed into a jquery lightbox pop-up.

    Adblock in Chrome is interfering with the display of the thumbnail images in the gallery. While the 1st thumbnail image and “default thumb” for posts without any set thumbnail loads, the subsequent thumbnails called from the_post_thumbnail function do not appear.

    I’m a bit flummoxed at this stage, having spent a considerable amount of time searching for a fix. I don’t think it’s an issue about the filterlists as this post describes: https://tinyurl.com/aj3mt5

    But, my guess is that it has to do with the way the thumbnails are being called by the function itself? The site is currently in development locally, but I’ve copied the pertinent code below. Any help or advice would be greatly appreciated.

    Besides having to detect and then display a message telling someone to turn-off their adblocking software, I’m wondering if anyone else has encountered this problem and found a solution?

    <div id="projectBrowser">
    
    					<?php 
    
    					$featured = array(
    						'posts_per_page' => 6,
    						'post__in'  => get_option('sticky_posts')
    													);
    
    					query_posts($featured);
    					?>
    
    					<?php if (have_posts()) : while (have_posts()) : the_post(); {?>
    
    						<a href="<?php the_permalink(); ?>?iframe=true&width=100%&height=100%" class="" rel="prettyPhoto[iframe]" >
    						<div class="project caption">
    
    							<?php
    
    									if ( has_post_thumbnail() )//Insert featured thumbnail for project or default if not specified
    									the_post_thumbnail( 'project-thumbnail' );
    									else
    									echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default_thumb.jpg" alt="" title="" />';
    							?>
    
    							<div class="cover projectcaption">
    								<h3><?php the_title(); ?></h3>
    								<?php the_excerpt(); ?>
    							</div>
    
    							<span class="projectCategory">
    							<p><?php // Retrieve name of category of each featured project
    							$category = get_the_category();
    							echo $category[0]->cat_name; ?>
    							</p>
    							</span>
    
    						</div><!--project caption-->
    						</a>
    
    					<?php } ?>
    
    					<?php endwhile; endif; ?>
    
    					</div><!--#projectBrowser -->
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter tnoguchi

    (@tnoguchi)

    bump

    Is there anyone out there who has encountered this issue?

    Thread Starter tnoguchi

    (@tnoguchi)

    bump; I’ve been searching all over the internet, but no luck. Has anyone encountered a similar problem? Can anyone provide a solution?

    Thread Starter tnoguchi

    (@tnoguchi)

    <slaps forehead>

    It was indeed the thumbnail dimensions!

    I just checked, and even though I had changed my thumbnail dimensions by adding 2 pixels to the custom ‘project-thumbnail’ size here:

    set_post_thumbnail_size( 200, 200, true); // Set post thumbnail size, hard crop mode
    
    add_image_size( 'project-thumbnail', 322, 252, true ); // Homepage project browser thumbnails

    I didn’t regenerate my thumbnails, barring that, the thumbnail dimensions of 320 x 250 were being blocked.

    Hope this helps someone else who’s having the same problem. Just remember to change the dimensions of your thumbs, and don’t forget to regenerate them.

    Moderator James Huff

    (@macmanx)

    Thanks for posting the solution!

    I highly recommend reporting that to Adblock’s developer. It seems rather ridiculous to block an image based on dimensions alone.

    Thread Starter tnoguchi

    (@tnoguchi)

    I’m not sure if they’ll comply, but I just hope this helps someone in the future. You can go to this link for more information about this problem:

    https://tinyurl.com/aj3mt5

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Chromium Adblock blocks thumbnails pulled from the_post_thumbnail function’ is closed to new replies.