Twitter embed block should expose options for how the tweet is displayed
The embed shortcode allows for controlling things like if media should be displayed, if the thread should be displayed, and the language of the follow buttons. These should be exposed as options for the tweet embed
The embed shortcode allows for controlling things like if media should be displayed, if the thread should be displayed, and the language of the follow buttons.
Are these available in the default installation? Or are you referring to the [tweet] shortcode included in Jetpack? The challenge with this is that the arguments controlling these are added server-side to the provider URL, not the URL of the embed (which itself is a provider argument):
https://github.com/Automattic/jetpack/blob/94dfd5b0a48ed2cc1332e4b09b615299bd674ade/modules/shortcodes/tweet.php#L97-L106
Example: https://publish.twitter.com/oembed?maxwidth=525&maxheight=788&hide_media=true&url=https%3A%2F%2Ftwitter.com%2Fwpcincinnati%2Fstatus%2F910313465033691142
I think the most reasonable option here would be to allow the embed block to store additional provider arguments (in its comment attributes) which are then applied during the oembed_fetch_url filter during its server-side rendering pass. These would also need to be included in the call to the oEmbed proxy endpoint in previewing the embed in the editor.
I think it would be nice to have options for the block that allow you to change any of these options.
https://dev.twitter.com/web/embedded-tweets/parameters
@aduth
Related progress here: #3032
@ntsekouras Nik. Perhaps you have some view points on this issue?
Apart from the possibility of having a setting for number of tweets to show - when a Twitter timeline is embedded (as described in https://github.com/WordPress/gutenberg/issues/19417), It would be great to have other settings available as well, e.g.: theme, language, width, height (settings available through https://publish.twitter.com/#) when embedding manually:

Apart from the possibility of having a setting for number of tweets to show - when a Twitter timeline is embedded (as described in #19417), It would be great to have other settings available as well, e.g.: theme, language, width, height (settings available through https://publish.twitter.com/#) when embedding manually:
I would also like to have these options, especially the height, as it was in the old twitter timeline.
Worth noting that the style option seems to be gone now. But yes, there's still a language option. Perhaps we should set it to the site language by default and allow it to be changed. Seems relatively easy to implement.
There's also an option now to embed the video of a tweet.
I would love to have a list of what options there are now and some feedback on if this is still something to consider then we can move this onward.
Coming back to this one, it's genuinely unclear to me what options are available for Twitter embeds in today's landscape. If there are any, do we trust them surviving between releases? If there are positive answers to both, then I would recommend this PR actually move right into development: there should be enough componentry to add toggles for video embeds, or dropdowns for language, to the inspector under "Settings". If a PR were to materialise, please add design labels if design feedback is helpful—I'd be happy to personally help review and provide any design asisstance in-review. But largely, if there is a path forward on this one, it is blocked on development.
I'd like to pick this up and wanted to check the approach before opening a PR, since it was unclear earlier whether X still supports these options.
What's still available: X's widgets.js still reads per-post attributes on the <blockquote class="twitter-tweet"> it renders: data-cards="hidden" (hides photos, videos and link previews) and data-conversation="none" (hides the original post of a reply). The [tweet]-style server options from the original description would need changes to the oEmbed proxy, core-data and WP_oEmbed, so I'd avoid that route.
Proposed change:
- Add two boolean attributes to
core/embed,hideMediaandhideThread, with no default so existing content is unchanged. - Show "Hide media" and "Hide thread" toggles in a Settings panel only for the X variation.
- Editor: add the data attributes to the preview HTML before it goes into the sandbox.
- Front end: add a small
render_block_core_embed()callback that adds the same attributes withWP_HTML_Tag_Processor, since the oEmbed HTML is already in the block content at render time.
Trade-offs:
- This gives
core/embeda server render callback, so it becomes a hybrid block. The callback returns early unless one of the options is set. - It depends on X keeping these
widgets.jsattributes. If X drops them, posts just show in full and nothing breaks.
I'd leave the language option out for now and possibly follow up with a site-language default, as suggested above.
Does this sound reasonable? I have a working version locally and can open a PR once there's agreement, possibly with just one of the two toggles if you'd rather keep it smaller.
It depends on X keeping these widgets.js attributes. If X drops them, posts just show in full and nothing breaks.
This is a bit of a flag for me, which suggest we close this issue and don't pursue this after all. We don't want to be in the business of doing API whack-a-mole with what is supported vs. what is not, and since the APIs have changed and closed so much in the latest iteration of this network, I would not trust them to keep anything as it has been.