-
Notifications
You must be signed in to change notification settings - Fork 800
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
Move AMP rendering of [youtube] shortcode to Jetpack from AMP plugin #14010
Move AMP rendering of [youtube] shortcode to Jetpack from AMP plugin #14010
Conversation
In continuation of the [vimeo] shortcode AMP migration. The intent is to not change how the rendering worked in the AMP plugin, only to migrate it to Jetpack.
To follow coding standards, ensure the array() ends with a ,
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: November 19, 2019. |
This should actually be '', as that is the behavior of the AMP plugin before.
Separate PRs? Hi @jeherve, Is it alright to open a separate PR for each shortcodes to migrate to Jetpack? If it's alright, there are 4 more AMP shortcodes after this that we'd like to migrate to Jetpack. Though this isn't urgent, I know reviewing them can be a lot of work. Also, let me know if you'd like me to fix the Code Climate issues. Thanks, Jeremy! |
That's absolutely fine, yes. In fact, separate PRs are better I think, they're easier to review and to work on. |
As Jeremy mentioned, jetpack_get_youtube_id() should work in place of the custom function get_amp_youtube_id_from_url(). It actually passes the unit test: test_get_amp_youtube_id_from_url().
As Jeremy mentioned, the <a> with the fallback URL didn't have a closing </a> before.
As Jeremy mentioned, this logic was run in 2 functions. So move this to the top of youtube_shortcode().
As Jeremy mentioned, it doesn't only get query args.
As Jeremy mentioned, if there's no $id, there's a comment with an error message. So do something similar if the $args are empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice edits, we are getting there I think. I only have one remark right now.
Co-Authored-By: Jeremy Herve <jeremy@tagada.hu>
Also, pass another argument to sprintf(). And update a few tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I'll merge on Monday after testing on WordPress.com as well. Thank you!
Caution: This PR has changes that must be merged to WordPress.com |
Thanks, Jeremy! Have a great weekend. |
WordPress.com does not run the latest version of the AMP plugin yet.
kienstra, Your synced wpcom patch D35551-code has been updated. |
* 8.0 Release: running changelog * Changelog: add #13921 * Changelog: add #13980 * Changelog: add #13905 * Changelog: add #13971 * Changelog: add #13984 * Changelog: add #14009 * Changelog: add #13620 * Remove things that will ship in 7.9.1 * Changelog: add 7.9.1 release (#14044) * Changelog: add base for 7.9.1 release * Update release date and post link * Changelog: add #14066 * Update changelog for 7.9.1 * Changelog: add #13405 * Changelog: add #13841 * Changelog: add #13924 * Changelog: add #13986 * Changelog: add #14010, #14028, #14053, #14055. * Changelog: add #14054 * Changelog: add #14031 * Changelog: add #14039 * Changelog: add #14050 * Changelog: add #14070 * Changelog: add #14082 * Changelog: add #14084 * Changelog: add #14111 * Changelog: add #13961 * Changelog: add #14047 * Changelog: add #14091 * Changelog: add #14108 * Changelog: add #14121
Summary
This moves the AMP handling of the
[youtube]
shortcode from the AMP plugin to Jetpack. Very similar to #13921, but for[youtube]
instead of[vimeo]
.Fixes ampproject/amp-wp#3309
Changes proposed in this Pull Request:
[youtube]
shortcode handling from the AMP plugin[youtube]
shortcode logic for reuse with the AMP shortcode, no intended change to itIs this a new feature or does it add/remove features to an existing part of Jetpack?
This is a new feature for Jetpack, but moved from the AMP plugin
Testing instructions:
wp-config.php
hasdefine( 'JETPACK_DEV_DEBUG', true);
/wp-admin
, in the Jetpack 'Settings' page, and in the 'Writing' tab, ensure this is toggled on:[youtube]
shortcode callback: Remove handling of Jetpack shortcodes ampproject/amp-wp#3678$ npm install && composer install
&
or?amp
to the URL, and look at how the Vimeo shortcode lookscheckout
themaster
branch of Jetpack, not this PR's branchmaster
branchBefore
After
Proposed changelog entry for your changes:
Migrate AMP-conversion of
[youtube]
shortcode to Jetpack from the AMP plugin