Support » Fixing WordPress » Chromium Adblock blocks thumbnails pulled from the_post_thumbnail function

  • Resolved tnoguchi



    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:

    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">
    					$featured = array(
    						'posts_per_page' => 6,
    						'post__in'  => get_option('sticky_posts')
    					<?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">
    									if ( has_post_thumbnail() )//Insert featured thumbnail for project or default if not specified
    									the_post_thumbnail( 'project-thumbnail' );
    									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(); ?>
    							<span class="projectCategory">
    							<p><?php // Retrieve name of category of each featured project
    							$category = get_the_category();
    							echo $category[0]->cat_name; ?>
    						</div><!--project caption-->
    					<?php } ?>
    					<?php endwhile; endif; ?>
    					</div><!--#projectBrowser -->
Viewing 5 replies - 1 through 5 (of 5 total)
  • bump

    Is there anyone out there who has encountered this issue?

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

    <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


    Volunteer Moderator 🚀

    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.

    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:

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.