Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the instagram embed #2003

Closed
wants to merge 4 commits into from
Closed

Update the instagram embed #2003

wants to merge 4 commits into from

Conversation

jkudish
Copy link
Contributor

@jkudish jkudish commented Apr 21, 2015

This syncs the instagram integration from WordPress.com to Jetpack with some changes I did over the last 3 days:

  • Add alternate username-based URL format handler for instagram embed and shortcode
  • Remove no longer needed fallback for older format embeds
  • Fix a typo for the comment returned when there is no embed found
  • Adjust the way the instagram script is loaded/fired so that it works with infinite scroll -- this adds a new js file that is enqueued properly (and thus compatible with infinite scroll) and detects IS loads and fires the appropriate instagram function to reprocess any images on the page

Note that this last bit adds a new file shortcodes/js/instagram.js which has a corresponding file on WordPress.com and will need to be added to the build script as per @dereksmart's instructions :)

* Add alternate username-based URL format handler for instagram embed and shortcode
* Remove no longer needed fallback for older format embeds
* Fix a typo for the comment returned when there is no embed found
* Adjust the way the instagram script is loaded/fired so that it works with infinite scroll -- this adds a new js file that is enqueued properly (and thus compatible with infinite scroll) and detects IS loads and fires the appropriate instagram function to reprocess any images on the page
@jkudish jkudish assigned jkudish and unassigned jkudish Apr 21, 2015
@kraftbj kraftbj added the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Apr 21, 2015
@kraftbj kraftbj added this to the 3.6 milestone Apr 21, 2015
@kraftbj kraftbj added the [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Apr 21, 2015
jkudish added a commit that referenced this pull request Apr 21, 2015
Adjust the way the facebook script is loaded/fired so that it works with infinite scroll -- this adds a new js file that is enqueued properly (and thus compatible with infinite scroll) and detects IS loads and fires the appropriate facebook function to reprocess any embeds on the page that were loaded via IS.

Similar approach to #2003 for instagram
@samhotchkiss samhotchkiss modified the milestones: 3.6, 3.5.1 Apr 23, 2015
}

// there's a script in the response, which we strip on purpose since it's added above
wp_enqueue_script( 'jetpack-instagram-embed', plugins_url( 'js/instagram.js', __FILE__ ), array( 'jquery' ) );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider updating this enqueue to wp_enqueue_script( 'jetpack-instagram-embed', plugins_url( 'js/instagram.js', __FILE__ ), array( 'jquery' ), 1.0, true ); to ensure that it is loaded at the end of the page. The script specifically relies on the <body> tag being present, so it makes sense to specify that it is loaded in the footer to prevent it from being loaded early.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we updated this on the WP.com side, and I've now updated this PR as well. Thanks for reviewing this.

prevents js errors with loading things before the main content is ready
Instagram Shortcode: Don't bother trying to validate the URL because this is no different than doing [embed]URL[/embed] and the WP_Embed class will take care of verifying the URL as being valid. If it's not, it'll just return a clickable URL.

Props @Viper007Bond
@dereksmart
Copy link
Member

merged in with cbc53d4

@dereksmart dereksmart closed this May 18, 2015
@dereksmart dereksmart removed [Status] In Progress [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels May 18, 2015
@dereksmart dereksmart deleted the fix/instagram-embeds branch May 18, 2015 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Shortcodes / Embeds [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants