That can indeed happen, depending on the method you use to insert the Instagram photos in your posts.
When using Jetpack’s Instagram shortcode, Jetpack will insert the image and will also load an additional file straight from Instagram’s website, in order to display the Instagram image and all the additional Instagram features around it.
That should work well. However, when you load more posts without actually reloading the page (like with a plugin like Ajax Load More), that additional file can’t be loaded and the image won’t appear.
Could you try to deactivate Jetpack’s Shortcode Embeds module for a few minutes (you can do so under Jetpack > Settings > Writing in your dashboard), and then create a new post where you will post an Instagram URL on its own line, without using any shortcode, like so:
http://i.wpne.ws/jRUy
When adding an Instagram URL on its own line like this, you don’t need any extra plugin; WordPress itself will take care of transforming the URL into an Instagram embed.
Publish the post, and see if it can be displayed properly. You can then change the post’s published date so it doesn’t appear on the first batch of posts that appear on your site, but only later when using the Ajax Load More plugin.
Let me know if the problem remains then!
-
This reply was modified 9 years, 1 month ago by
Jeremy Herve.
Excellent, I’m glad to hear it.
You should now be able to enable the Shortcode embeds module again; as long as you use the Instagram URLs on their own line, everything should work.
As luck would have it…
So, I deactivated Jetpack’s Shortcode Embeds module for a few hours and we were able to scroll down and see other posts and the Instagram embeds were working. We also noticed that the shortcode for Soundcloud stopped working. We assumed this was normal behavior. Then we turned the module back on. The Instagram embeds stopped working.
Any suggestions?
Try adding the following code snippet to a functionality plugin like this one:
/**
* Remove Jetpack's Instagram shortcode.
*
* @param array $shortcodes Array of shortcodes enabled by Jetpack on the site.
*/
function jeherve_remove_jp_shortcode( $shortcodes ) {
$jetpack_shortcodes_dir = WP_CONTENT_DIR . '/plugins/jetpack/modules/shortcodes/';
$shortcodes_to_unload = array( 'instagram.php' );
foreach ( $shortcodes_to_unload as $shortcode ) {
if ( $key = array_search( $jetpack_shortcodes_dir . $shortcode, $shortcodes ) ) {
unset( $shortcodes[ $key ] );
}
}
return $shortcodes;
}
add_filter( 'jetpack_shortcodes_to_include', 'jeherve_remove_jp_shortcode' );
You can then enable the Shortcode Embeds module back.
Let me know how it goes.
I installed the Code Snippets plug in.
I added the code you sent over.
Easy.
As of now, the Jetpack > Settings > Shortcut Embeds is turned on.
When I look at my site on mobile, the first article displays the Instagram embed, the Ajax Load More displays the next article and the Instagram embed does not display.
Should I clear my cache from my host (WP Engine)? or clear my cache from Cloudflare?
It might be good to do both.
Let me know how it goes!