• Resolved latrishablevins

    (@latrishablevins)


    Hello, the plugin suddenly stopped showing images. Post titles are there, but images do not show. I have checked the posts, and the featured images are ok. Can you check, please?

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @latrishablevins,

    If it was working before and then it “suddenly” stopped working it’s probably due to a change you made on your site. Do you remember what exactly was changed recently?

    Thread Starter latrishablevins

    (@latrishablevins)

    Hi, yesterday I updated the plugins Featured Image from URL (FIFU) and Simple Cloudflare Turnstile. The plugins update automatically, so I didn’t change anything except that. I have been using WordPress Popular Posts for 3 years with all currently installed plugins. I have cleared the WP-Rocket cache, but the issue is still present.

    Thread Starter latrishablevins

    (@latrishablevins)

    I purposely did not delete the WordPress Popular Posts cache because that alone would temporarily solve the problem. At least, I think so.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yeah, clearing WordPress Popular Posts’ image cache isn’t necessary in most cases so you did good leaving it alone.

    My initial guess is that it might be due to FIFU but I’m not really familiar with that plugin as I’ve never used it before. I’ll install it on a test site when I get the chance to try it out and see what happens.

    Thread Starter latrishablevins

    (@latrishablevins)

    I have been using FIFU and WPP from the beginning. FIFU automatically adds the first image as featured, and all have worked flawlessly for years. Strange.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, so I installed FIFU on my test site and played around with it for a bit. According to your comments FIFU used to play along with WPP but now it doesn’t anymore so my guess is that something changed recently on FIFU’s side that broke compatibility between the two plugins.

    As a workaround to get your popular posts thumbnails to render again please follow these instructions:

    #1 Go to Plugins > Plugin File Editor and select the WordPress Popular Posts plugin.

    #2 Click on src > Image.php to edit this file.

    #3 Replace the contents of the Image.php file with this version.

    #4 Click on the Update File button to save changes.

    #5 Add the following code snippet to your theme’s functions.php file (or via the Code Snippets plugin for example):

    /**
     * Replaces WordPress Popular Posts' thumbnails with
     * the stock post thumbnail (FIFU plugin compatibility patch).
     *
     * @param string $img_tag The original thumbnail image tag as generated by WPP
     * @param int $post_id The post / page ID.
     * @return string The (modified) thumbnail image tag.
     */
    add_filter( 'wpp_render_image', function($img_tag, $post_id) {
    	$featured_image = get_the_post_thumbnail($post_id, array(320, 420));
    	
    	if ( $featured_image ) {
    		return $featured_image;
    	}
    	
    	return $img_tag;
    }, 10, 2);

    The only thing that you may want to adjust in that code snippet is the thumbnail size. Change array(320, 420) to your desired width/height combo.

    • This reply was modified 1 year, 3 months ago by Hector Cabrera. Reason: Fixed typo
    Thread Starter latrishablevins

    (@latrishablevins)

    No matter what dimensions I set, the aspect ratio looks wrong, not like before. I used to keep widget settings at 320×420 px and theme tiles. Now whatever dimension I put in functions.php under each image is a gap and weird aspect ratios. How to fix this?

    Thread Starter latrishablevins

    (@latrishablevins)

    …and on mobile, the plugin is not responsive anymore.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Ah, forgot to mention that as part of the workaround you’ll need to register a new image size as well, and then use the Regenerate Thumbnails plugin to create the actual thumbnails for this new image size.

    To register a new image size you need to use the add_image_size() function, like so for example:

    add_image_size( 'sidebar-thumb', 320, 420, true );

    320 corresponds to the width of the image, 420 to height. Adjust if needed.

    You need to add that code snippet to your theme’s functions.php file or via the Code Snippets plugin as suggested earlier.

    Once you have added that, as I said before, regenerate your thumbnails and check again

    …and on mobile, the plugin is not responsive anymore.

    It’s due to the image size. Fix that and it’ll work fine.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Suddenly stopped showing images?’ is closed to new replies.