WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Chromium Adblock blocks thumbnails pulled from the_post_thumbnail function (6 posts)

  1. tnoguchi
    Member
    Posted 3 years ago #

    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: http://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 -->
  2. tnoguchi
    Member
    Posted 3 years ago #

    bump

    Is there anyone out there who has encountered this issue?

  3. tnoguchi
    Member
    Posted 3 years ago #

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

  4. tnoguchi
    Member
    Posted 3 years ago #

    <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.

  5. 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.

  6. tnoguchi
    Member
    Posted 3 years ago #

    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:

    http://tinyurl.com/aj3mt5

Topic Closed

This topic has been closed to new replies.

About this Topic