Title: [Plugin: Network Latest Posts] multiple instances thumbnail issue
Last modified: August 20, 2016

---

# [Plugin: Network Latest Posts] multiple instances thumbnail issue

 *  Resolved [sortofme](https://wordpress.org/support/users/sortofme/)
 * (@sortofme)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/)
 * Hi, first of all, many thanks for this plugin, it rocks!
 * But I have a small issue: I am using your plugin multiple times in the sidebar,
   and the first instace imports the post thumb well */blig.dir/35/*, but instance
   2 and instance 3 both have in the thumbnail url */blig.dir/2/* so basically trying
   to find the image in blog with the id 2. weirdly the rest of the content is picked
   from the right blog ID.
    could you maybe direct me towards where I can alter 
   the code to fix this? kr Simon view this here: [http://www.sortofme.com](http://www.sortofme.com)(
   sorry is in german)
 * [http://wordpress.org/extend/plugins/network-latest-posts/](http://wordpress.org/extend/plugins/network-latest-posts/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Jose Luis SAYAGO](https://wordpress.org/support/users/iluminatus/)
 * (@iluminatus)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061797)
 * Hello Simon,
 * Thanks for your comment, nice site by the way. I see what you mean, but just 
   wondering, did you recently migrate the blog with id #2? The plugin seems to 
   be working as expected but if you go to: [Nellahs Tipp: selbst gemachtes nuss – granola müsli](http://sortofme.com/leckerschmecker/2011/05/post/nellahs-tipp-selbst-gemachtes-nuss-%E2%80%93-granola-musli/)
   Images are missing.
 * This happened to me when I migrated one of my sites and for some reason files
   inside folder `/files/year/month/` weren’t copied with the rest of the folders
   and files.
 * Could you please check the images are really inside the folder `/blogs.dir/2/
   files/2011/05/` as they should be? and if they are, check if they have reading
   permissions.
 * Let me know if there’s something else I can help you with.
 * Cheers.
 *  Thread Starter [sortofme](https://wordpress.org/support/users/sortofme/)
 * (@sortofme)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061917)
 * Hi thanks for your response! yes I actually changed the site’s name, which broke
   the image paths… BUT the problem is, that this should be blog ID 52, and 62 respectively,
   and not blog id 2…. weird is that it does work for the first instance (blog id
   35), but the 2nd and 3rd instance all try to pull the image from *blogs.dir/2/*..
   no idea where blogid 2 comes from.
 *  Plugin Author [Jose Luis SAYAGO](https://wordpress.org/support/users/iluminatus/)
 * (@iluminatus)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061939)
 * Hi Simon,
 * Well it’s pretty weird, I think this is not a problem related to NLPosts but 
   to your images’ paths. This is because NLPosts uses the WordPress hook `get_the_post_thumbnail`
   which retrieves featured images set for your posts and are stored into the posts’
   table as `attachment`.
 * I’ve checked your nlp instances, you have 3: nlp-instance-2, nlp-instance-3, 
   nlp-instance-4. From those only nlp-instance-2 is working ok. You say The first
   instance is blog id 35 but the thumbnail is being taken from blog id 6, so I’m
   wondering where are you seeing those id numbers?
 * So I have another question, when you updated your post images to fix the paths,
   did you also fixed the thumbnails? Because thumbnails are generated statically
   only once, it means, once you created the thumbnail using the “Featured Image”
   function, they will stay there forever, even if you update the post they won’t
   be created again. If you changed paths or urls, thumbnail urls won’t be updated,
   they will be pointing to the old path until you change that manually if the old
   path don’t exist anymore, the result is… missing images.
 * You can also check where your blog Upload path is pointing to, go to Network 
   Admin > Sites > Select your site > Settings then check the Upload Path parameter(
   but I doubt this is wrong, I firmly believe those thumbnails just need to be 
   created again, that’s all).
 * Let me know what do you find.
 * P.S: You can check two instances for different blogs working together here: [Widgets NLPosts](http://testlab.8elite.com/posts/)
 * Cheers.
 *  Thread Starter [sortofme](https://wordpress.org/support/users/sortofme/)
 * (@sortofme)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061957)
 * thank ypou so much for looking into this. Unfortunately I can’t find the reason
   why I can’t get it to work. the images are there, but for some reason, the nlp
   plugin does not write the URl correctly..
    so instead of: [http://sortofme.com/leckerschmecker/wp-content/blogs.dir/52/files/2011/05/Muesli1-150×150.jpg](http://sortofme.com/leckerschmecker/wp-content/blogs.dir/52/files/2011/05/Muesli1-150×150.jpg)
 * it tries to find the image at [http://sortofme.com/leckerschmecker/wp-content/blogs.dir/2/files/2011/05/Muesli1-150×150.jpg](http://sortofme.com/leckerschmecker/wp-content/blogs.dir/2/files/2011/05/Muesli1-150×150.jpg)
 * (the difference lies in the blog ID) What I don’t understand, is why this works
   for one of them, but not the others…
    Of course I have checked whether the post
   thumbnails have been updated as well, but if I correct the URL in the browser,
   the images do display).
 * I also found the code within your plugin on line 489
    `$thumb_html = get_the_post_thumbnail(
   $field->ID,$thumbnail_size,array('class' =>$thumbnail_class));` and this seems
   right. so am a bit desperate, I already spent quite some time trying to figure
   that one out now….
 *  Thread Starter [sortofme](https://wordpress.org/support/users/sortofme/)
 * (@sortofme)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061958)
 * interestingly, the samples you have on your site, are all pulling the images 
   from blog.dir/2/* as well, except for the last instace, which is pulling them
   from blog id 5
 *  Thread Starter [sortofme](https://wordpress.org/support/users/sortofme/)
 * (@sortofme)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061959)
 * in case you have a look, it now works, but because of an awefull hack, that will
   make it fall when u have a new update, but had to get this done somehow.
    So 
   I str_replaced one part
 * `$thumb_html = str_replace( "wp-content/blogs.dir/2", '',get_the_post_thumbnail(
   $field->ID,$thumbnail_size,array('class' =>$thumbnail_class)));`
 * works fine.
    still would love to knwo how that has happened, apparently just 
   with me…
 *  Plugin Author [Jose Luis SAYAGO](https://wordpress.org/support/users/iluminatus/)
 * (@iluminatus)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061963)
 * Hi Simon, yes in those examples you see in my blog thumbnails display id 2 mostly
   because it’s my blog in english which is the one with most recent content to 
   show, but if you check images here: [NLPosts CSS](http://testlab.8elite.com/css/)
   each thumbnail is pulled from their own blog id, (2 english, 5 spanish).
 * I was digging a little bit about this issue and found this: [MULTISITE not defined](http://wordpress.org/support/topic/multisite-not-defined?replies=6).
   Apparently people who upgraded “jumping” two or more versions were having issues
   with file paths.
 * Just wondering if this is your case, the problem I see with your hack if implemented,
   is for those of us who have a blog id 2 will see it stripped out which will result
   in missing images.
 * I would suggest you to try one of these plugins: [Thumbnail sizing](http://wordpress.org/support/topic/plugin-network-latest-posts-thumbnail-sizing?replies=6)
   this topic was opened for thumbnail sizes, but I think it would help you to regenerate
   all thumbnail images and hopefully fix their paths.
 * As I told you before, I don’t believe this is a bug in NLPosts but an issue with
   your WordPress installation or maybe upgrading history. I will explain the reasons
   why I believe so:
 * Network Latest Posts uses this hook to pull thumbnails:
 *     ```
       // Get the thumbnail
       $thumb_html = get_the_post_thumbnail($field->ID,$thumbnail_size,array('class' =>$thumbnail_class));
   
       // If there is a thumbnail
       if( !empty($thumb_html) ) {
            // Display the thumbnail
            echo "<a href='".$all_permalinks[$field->guid]."'>$thumb_html</a>";
       }
       ```
   
 * Where `$field->ID` is the post’s ID, considering your post titles and other links
   are pointing to the right article, it’s impossible NLPosts is taking the wrong
   $field->ID number, otherwise it would be reflected in wrong links everywhere.
   So this take us to the thumbnails paths stored into the database.
 * If you use that hook manually in a test page, `get_the_post_thumbnail(post_id_here)`
   you can see what’s being pulled out. Of course it must be used in a file within
   the blog you want to test.
 * `get_the_post_thumbnails` will pull information related to attachments for a 
   specific post ID, NLPosts doesn’t interfere with this hook, it doesn’t change
   URLs or paths anywhere, it just pulls out paths already stored when those images
   were added to the post and were created by WordPress attachment functions.
 * As for blog IDs they’re pulled from wp_blogs table, and as stated before, your
   posts are being correctly extracted and links are working ok so it can’t be a
   problem with incorrect blog IDs. So thumbnails issues must be being caused by
   a malfunction somewhere in your blogs mostly related to thumbnails generation.
 * If you try one of those plugins to regenerate thumbnails, let me know if that
   worked for you.
 * P.S: I forgot to mention this topic [problem thumbnails](http://wordpress.org/support/topic/plugin-network-latest-posts-problem-thumbnails?replies=5)
   someone else had issues with thumbnails using NLPosts but those problems were
   related to external plugins, and NLPosts v3 doesn’t use the same code to display
   thumbnails anymore.
 * I hope this helps you find out what’s going on.
 * Kind regards.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: Network Latest Posts] multiple instances thumbnail issue’ is
closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/network-latest-posts_61c601.svg)
 * [Network Latest Posts](https://wordpress.org/plugins/network-latest-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/network-latest-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/network-latest-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/network-latest-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/network-latest-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/network-latest-posts/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Jose Luis SAYAGO](https://wordpress.org/support/users/iluminatus/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-network-latest-posts-multiple-instances-thumbnail-issue/#post-3061963)
 * Status: resolved