• Resolved Clayton Chase

    (@claytonchase)


    Hey,

    Here is a page where you can see what I mean: https://www.dogsnaturallymagazine.com/fecal-transplants-heal-your-dog-inside-out/

    Any posts posted within the past few days seem to be working (if you look under the ALL TIME tab you’ll see one post that is displaying the feature image properly).

    Here is a link to the settings I have in place: https://imgur.com/a/GimfLBE

    The site is hosted with WP Engine. I’ve cleared all caching on the site including the thumbnail cache setting in the plugin options. It seems strange to me that it is working on newer posts but not on older posts?

    Any help would be greatly appreciated!

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

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

    (@hcabrera)

    Hey @claytonchase,

    This is kinda the same issue you reported months ago, my answer is pretty much the same as the one from back then.

    When you set Pick image from to Featured Image, WPP expects Featured Images to be stored within the uploads folder because that’s the “stock” behavior on WordPress. Yours appears to be stored on a CDN (WPEngine’s, I suppose) which would explain why WPP fails to find them and thus since the plugin can’t generate the thumbnails the widget ends up displaying the default thumbnail instead.

    I know this can happen if you’re using the “Set size manually” option from the widget (under Display post thumbnail). I’m 99% sure that if you pick the “Use predefined size” option instead it’ll work because then thumbnails are generated/handled entirely by WordPress (and in theory it should know where your CDN images are) – but then you’d need to:

    1. register a new image size equal to the one you’re using with the widget first so you can select it in the widget;
    2. Use a thumbnail regeneration plugin (like this one) to (re)generate your popular posts thumbnails; and
    3. Clear your site’s cache so all changes are reflected on the front-end.

    Give that a shot and report back your results, alright?

    Plugin Author Hector Cabrera

    (@hcabrera)

    … but it also could be something entirely different. Can’t tell without more details so I can try to reproduce the issue.

    Thread Starter Clayton Chase

    (@claytonchase)

    Okay, I’ll try removing the set image size manually option and see what that does. I’m not using the widget but I suspect is has something to do with the CDN.

    Thanks for you reply Hector!

    • This reply was modified 6 years, 4 months ago by Clayton Chase.
    Plugin Author Hector Cabrera

    (@hcabrera)

    If you’re using either the wpp_get_mostpopular() template tag or the [wpp] shortcode, then of course some the above instructions don’t apply to you ??

    To have wpp_get_mostpopular()\[wpp] use thumbnails generated by WordPress, you’ll need a slightly different approach:

    1. In your code, remove the {thumb} Content Tag as we’re not going to use WPP’s thumbnails. We’re replacing it with a custom one called {custom_thumb} (or whatever you prefer to name it) so we can get thumbnails directly from WordPress.
    2. Next, we’re hooking into wpp_parse_custom_content_tags to create our new custom Content Tag, {custom_thumb}:
      /**
       * Parses custom content tags in WordPress Popular Posts.
       *
       * @param  string  $html    The HTML markup from the plugin.
       * @param  integer $post_id The post/page ID.
       * @return string
       */
      function wpp_parse_tags_in_popular_posts( $html, $post_id ){
      
          // Replace custom content tag {custom_thumb} with the actual custom thumbnail
          if ( false !== strpos($html, '{custom_thumb}') ) {
              // Get thumbnail
              $custom_thumb = '<a href="' . get_permalink( $post_id ) . '">' . get_the_post_thumbnail( $post_id, 'my-custom-size' ) . '</a>';
              // Replace content tag with thumbnail
              $html = str_replace( '{custom_thumb}', $custom_thumb, $html );
          }
      
          return $html;
      
      }
      add_filter( "wpp_parse_custom_content_tags", "wpp_parse_tags_in_popular_posts", 10, 2 );
    3. That’s it!

    Then follow the same instructions from before.

    Update: remember to change ‘my-custom-size’ with the actual name of your new image size.

    Thread Starter Clayton Chase

    (@claytonchase)

    Hector, this worked like a charm. Thank you so much!!

    Donate link?? ??

    Plugin Author Hector Cabrera

    (@hcabrera)

    You’re welcome! Glad I could help!

    I’m saving this topic to my Favorites as I’m sure I may need it again someday ??

    About the donation button, you can find it here right under Donate. A review is good too, if you prefer ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Featured Images Not Displaying on Older Posts’ is closed to new replies.