The shortcode callbacks for `gallery` and `playlist` check for `'RAND' == $atts['order']`, which isn't a valid value for `order`. Remove those checks and update the docs.
In `WP_Query`, if the value of `orderby` is `rand`, `order` is irrelevant and should be unset.
Adds unit tests.
Fixes#29629.
Built from https://develop.svn.wordpress.org/trunk@29760
git-svn-id: http://core.svn.wordpress.org/trunk@29532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Use a `MutationObserver` to listen to the `body` class of the parent editor frame.
* In `wpview_media_sandbox_styles()`, only return the MEjs stylesheets.
* In `wp_ajax_parse_media_shortcode()` and `wp_ajax_parse_embed()`, return an object instead of an HTML blob to allow passing `body` and `head` separately
Props avryl, azaozz.
Fixes#29048.
Built from https://develop.svn.wordpress.org/trunk@29615
git-svn-id: http://core.svn.wordpress.org/trunk@29389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Make them transparent.
- Don't load tons of unrelated styles that can break them. This could result in minimal styling mismatch to the front-end, but keeps the views working well and looking good.
Props avryl, fixes#29048.
Built from https://develop.svn.wordpress.org/trunk@29543
git-svn-id: http://core.svn.wordpress.org/trunk@29319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add a setting to `_wpMediaViewsL10n.settings`: `mediaTrash`
* In the attachment edit modal, properly toggle between Trash/Untrash
* In `media.view.Attachment`, add a method for `untrashAttachment`
* When creating the grid toolbar, switch the setting order of subviews so that `media.view.DeleteSelectedButton` can listen to the instance of `media.view.AttachmentFilters.All` to update the text in its UI.
* Add a new filter to `media.view.AttachmentFilters.All`, `trash`, when `settings.mediaTrash` is true
* Allow the cached queries in `Query.get()` to be flushed when race conditions exist and collections need to be refreshed. This is currently only being used when `MEDIA_TRASH` is set, to refresh the filtered/mirrored collections related to `all`, `trash`, and any already queried filter.
* Cleanup the bootstrapping of `media.view.MediaFrame.Manage`
* Allow `wp_ajax_query_attachments()` to return items from the trash when `MEDIA_TRASH` is `true`
* Allow `wp_ajax_save_attachment()` to set `post_status` when `MEDIA_TRASH` is `true`. It allows `wp_delete_post()` to be called, which will trash the attachment instead of deleting when the flag is set.
Props koop for the knowledge sharing and thought partnership.
See #29145.
Built from https://develop.svn.wordpress.org/trunk@29490
git-svn-id: http://core.svn.wordpress.org/trunk@29268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Don't set height on responsive `<div>` when generating markup
* Move some CSS rules from the style tag to `.wp-video`
* Use Video Details view event delegation instead of click events delegated from `<body>`
* Fix some CSS rule collision in the grid modal
See #29110.
Built from https://develop.svn.wordpress.org/trunk@29456
git-svn-id: http://core.svn.wordpress.org/trunk@29234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Align better visually with the existing media modal and the post image edit modal.
* Add back a link to the full attachment edit screen (post.php).
* Add a title to the modal and move prev/next buttons next to the more-consistent close button.
* Remove mode tabs (metadata vs. image editing) in favor of the Edit Image button.
Still to come: responsive, IE8 testing and targeted CSS (calc() usage), general CSS cleanup.
props ericlewis, helen, melchoyce. see #28844. fixes#28915.
Built from https://develop.svn.wordpress.org/trunk@29204
git-svn-id: http://core.svn.wordpress.org/trunk@28988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Added in [28652]:
* Various phpDoc improvements for `wp_embed_handler_youtube()`
* Adds `@see` reference to `wp_embed_handler_youtube()` in 'wp_embed_handler_youtube' filter docs
Added in [29029]:
* s/post_id/post ID in `@return` description for `attachment_url_to_postid()`
See #28885.
Built from https://develop.svn.wordpress.org/trunk@29164
git-svn-id: http://core.svn.wordpress.org/trunk@28948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add `visibility: hidden` as an inline style to `<audio>` tags, there is a race with the stylesheet which can get enqueued in the body and loaded in the footer.
* When creating new instances of `MediaElementPlayer`, always push them onto a stack. Lone views can be responsible for multiple instances of the same shortcode on render.
* Rename `wp.media.mixin.unsetPlayer()` to `wp.media.mixin.unsetPlayers()` to reflect the above.
* Call `wp.media.mixin.unsetPlayers()` on the view's `unbind()` method, instead of inline in the `render()` method
* Make sure `WPPlaylistView` is instantiated for each editor instance
* Ensure that the `No Items Found` view state is not rendered when attachments actually do exist.
Props gcorne, wonderboymusic.
See #27899.
Built from https://develop.svn.wordpress.org/trunk@28182
git-svn-id: http://core.svn.wordpress.org/trunk@28013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This has already been addressed for audio|video shortcodes, but also needs to be the case for playlists. When loading a playlist from a DOM cache or via AJAX, and when the sources match those already pre-loaded, the browser will sometimes donkey-punch the HTTP request for the first cached track selected.
Set `preload="none"` for the empty `<audio|video>` tag for playlists.
See commits related to #26779.
Built from https://develop.svn.wordpress.org/trunk@27974
git-svn-id: http://core.svn.wordpress.org/trunk@27804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Make attachment metadata for audio files editable by providing a metabox on the Edit Media page
* Standardize on using the attachment title everywhere
* Label the Caption and Description fields for audio and video appropriately
* Make the playlist Underscore templates more straightforward
See #27574.
Built from https://develop.svn.wordpress.org/trunk@27862
git-svn-id: http://core.svn.wordpress.org/trunk@27693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When a theme supports HTML5 captions via add_theme_support( 'html5', 'caption' ), figure and figcaption will be used instead of div and p.
There's a bonus. But first, some history: Captions were introduced with an inline style set for the container. This remains, as it is there to force captions to wrap. But this inline style included an extra 10 pixels, which have vexxed theme developers for years. While these pixels were designed to ensure padding around floated images, modern themes handle this with grace. The additional pixels thus feel encumbering.
As the new HTML5 gallery support avoids outputting default gallery styles (again, irking theme developers for years; see #26697), the new HTML5 caption support will also ditch these 10 pixels of unwanted hand-holding.
The 10 pixels are also removed entirely in the visual editor (and more styles may also disappear here; see #26642), giving themes the power necessary to match the frontend styles.
The filter img_caption_shortcode_width added in 3.7 to work around this madness (see #14380) is skipped entirely when the theme supports HTML5 captions.
props obenland, azaozz.
see #26642. also fixes#9066.
Built from https://develop.svn.wordpress.org/trunk@27668
git-svn-id: http://core.svn.wordpress.org/trunk@27511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Abstract the setting of a primary button and its callback in `wp.media.view.MediaFrame.MediaDetails`
* Account for the existence or non-existence of `$content_width` in the TinyMCE views for video
* Make sure video models always have dimensions, even if they are the defaults
* For browsers that are not Firefox, don't use a timeout when setting the `MediaElementPlayer` instance in TinyMCE views
See #27320.
Built from https://develop.svn.wordpress.org/trunk@27655
git-svn-id: http://core.svn.wordpress.org/trunk@27498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Support a `caption` attribute for audio and video shortcodes
* In `wp.media.audio|video`, rename `update` to `shortcode` to allow these models to share the same mixins as `wp.media.collection` subclasses
* When sending an audio or video shortcode to the editor, create a default caption if the user hasn't entered one. This currently only displays in the editor, not on the front end. Captions aren't tied to a specific attachment here because external sources are supported.
* In the `wp.mce.media` mixin, in the `edit` method, read `attr` instead of `data` when attempting to parse the encoded shortcode. `data` does not automatically update when the attribute changes. This was a blessing to debug.
* Add `wp.mce.media.PlaylistView` to support playlist views in TinyMCE
* Expose `WPPlaylistView` to global scope and suppress auto-parsing of playlist nodes when in the admin. Allow `WPPlaylistView` to be passed `metadata` on creation instead of requiring a JSON blob to be parsed.
* Remove all of the playlist logic from the `wpgallery` TinyMCE plugin.
* In `wp_prepare_attachment_for_js()` return more data for audio/video so that playlists can have parity in the admin/front end.
See #27320.
Built from https://develop.svn.wordpress.org/trunk@27640
git-svn-id: http://core.svn.wordpress.org/trunk@27483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
UX Changes:
* Don't add a menu item for "Add Audio|Video Source"
* In the Audio|Video Details modal, add buttons and some suggestive text for adding alternate playback sources
* Don't show "Create Audio|Video Playlist" menu items until the user has uploaded audio or video files
See #27437.
Built from https://develop.svn.wordpress.org/trunk@27608
git-svn-id: http://core.svn.wordpress.org/trunk@27451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add an action, `wp_playlist_scripts`, where a user can turn off all default script and style loading for playlists and roll their own.
* Move the script and style loading for playlists to a function, `wp_playlist_scripts( $type )`, that hooks into `wp_playlist_scripts`.
* Make the `<noscript>` playlist output an `<ol>`, instead of a list of links with no surrounding markup.
See #26631.
Built from https://develop.svn.wordpress.org/trunk@27486
git-svn-id: http://core.svn.wordpress.org/trunk@27330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add a state: `Add Subititles`
* Add `text/vtt` to the list of allowed mime-types, files end in `.vtt`. `.srt` files are served as `text/plain`.
* The content body of a video shortcode should be used for adding `<track>` elements only. This happens dynamically in the modal. If added by hand, they can still be parsed and managed.
See #27016.
Built from https://develop.svn.wordpress.org/trunk@27481
git-svn-id: http://core.svn.wordpress.org/trunk@27325 1a063a9b-81f0-0310-95a4-ce76da25c4cd