Commit Graph

460 Commits

Author SHA1 Message Date
Konstantin Obenland
5aa45cd12e Customize: Allow previewed menus to be customized
Fixes a bug where menu assignements couldn't be changed when previewing a theme.
Also removes an unnecessary call to menu mapping after a theme switch from the customizer and makes sure the locations option is always written, for good measure.

Props westonruter.
See #39692.

Built from https://develop.svn.wordpress.org/trunk@41995


git-svn-id: http://core.svn.wordpress.org/trunk@41829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 18:35:48 +00:00
Joe McGill
d21f6799a6 Customizer: Improve handling of crops in the media library.
This is a follow up on r41732, implementing the following improvements:

* Attachment parent info is now stored in attachment meta rather than a 
separate post meta key.
* Attachments created from contextual crops (e.g. header, logos, etc.) are
filtered out of the media library using a new `_filterContext` method in
`wp.media.controller.Library`.

Props joemcgill, westonruter.
See #21819.

Built from https://develop.svn.wordpress.org/trunk@41937


git-svn-id: http://core.svn.wordpress.org/trunk@41771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 04:18:47 +00:00
Weston Ruter
bd9d1d9178 Customize: Allow post/page stubs to be edited in WP Admin as "customization drafts" when changeset is saved as draft or scheduled.
* Update stubs to have draft status when changeset is saved as draft, instead of preventing auto-draft garbage collection by giving them a far-future `post_date`.
* Show notice in publish metabox when editing a customization draft indicating that it will be published automatically with its changeset; a link to Customizer is included.
* Include a new "Customization Draft" display post state in the post list table.
* Disconnect stubs from their changesets when they are updated with a status other than "Draft".
* Trash customization drafts when their related changeset is trashed or deleted.
* Add a `_customize_changeset_uuid` postmeta to stubs to link them with their associated changeset.
* Include `customize_changeset_uuid` as context when requesting to insert a new auto-draft.

Props westonruter, melchoyce.
See #39896, #39752, #34923.
Fixes #42220.

Built from https://develop.svn.wordpress.org/trunk@41887


git-svn-id: http://core.svn.wordpress.org/trunk@41721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-17 20:15:52 +00:00
Weston Ruter
3f2b453a4d Customize: Introduce WP_Customize_Manager::trash_changeset_post() to reduce duplication and ensure proper changeset trashing logic.
Trashing a changeset via `wp_trash_post()` does not have the desired result since it mutates `post_content` (via Kses) and the `post_name` (even though it is a UUID).

Props dlh.
See #39896, #42030.
Fixes #42175.

Built from https://develop.svn.wordpress.org/trunk@41824


git-svn-id: http://core.svn.wordpress.org/trunk@41658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-11 05:42:49 +00:00
Joe McGill
7e29c9646a Customizer: Minimize duplicate header crops in the media library.
This adds `Custom_Image_Header::get_previous_crop()`, which finds any
previously cropped headers created from the same base image and replaces
that attachment rather than creating a new attachment.

After updating a crop, the replaced images is also removed from the list
of previous header images in the Customizer.

See #21819.

Built from https://develop.svn.wordpress.org/trunk@41732


git-svn-id: http://core.svn.wordpress.org/trunk@41566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 14:59:48 +00:00
Konstantin Obenland
1e6810e433 Widgets: Revert format of sidebars_widgets.
Restores the data format of the `sidebars_widgets` theme mod to its pre [41555]
format. It can trigger PHP warnings after switching themes if that mod has not
been removed previously.

Fixes #39693.


Built from https://develop.svn.wordpress.org/trunk@41673


git-svn-id: http://core.svn.wordpress.org/trunk@41507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 18:11:46 +00:00
Weston Ruter
1a7616ad54 Customize: Extend changesets to support autosave revisions with restoration notifications, and introduce a new default linear history mode for saved changesets (with a filter for opt-in to changeset branching).
* Autosaved changes made on top of `auto-draft` changesets get written on top of the `auto-draft` itself, similar to how autosaves for posts will overwrite post drafts.
* Autosaved changes made to saved changesets (e.g. `draft`, `future`) will be placed into an autosave revision for that changeset and that user.
* Opening the Customizer will now prompt the user to restore their most recent auto-draft changeset; if notification is dismissed or ignored then the auto-draft will be marked as dismissed and will not be prompted to user in a notification again.
* Customizer will no longer automatically supply the `changeset_uuid` param in the `customize.php` URL when branching changesets are not active.
* If user closes Customizer explicitly via clicking on X link, then autosave auto-draft/autosave will be dismissed so as to not be prompted again.
* If there is a changeset already saved as a `draft` or `future` (UI is forthcoming) then this changeset will now be autoloaded for the user to keep making additional changes. This is the linear model for changesets.
* To restore the previous behavior of the Customizer where each session started a new changeset, regardless of whether or not there was an existing changeset saved, there is now a `customize_changeset_branching` hook which can be filtered to return `true`.
* `wp.customize.requestChangesetUpdate()` now supports a second with options including `autosave`, `title`, and `date`.
* The window `blur` event for `customize.php` has been replaced with a `visibilitychange` event to reduce autosave requests when clicking into preview window.
* Adds `autosaved` and `branching` args to `WP_Customize_Manager`.
* The `changeset_uuid` param for `WP_Customize_Manager` is extended to recognize a `false` value which causes the Customizer to defer identifying the UUID until `after_setup_theme` in the new `WP_Customize_Manager::establish_loaded_changeset()` method.
* A new `customize_autosaved` query parameter can now be supplied which is passed into the `autosaved` arg in `WP_Customize_Manager`; this option is an opt-in to source data from the autosave revision, allowing a user to restore autosaved changes.

Props westonruter, dlh, sayedwp, JoshuaWold, melchoyce.
See #39896.

Built from https://develop.svn.wordpress.org/trunk@41597


git-svn-id: http://core.svn.wordpress.org/trunk@41430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-26 07:38:45 +00:00
Konstantin Obenland
27536e99c5 Widgets: Improved sidebar mapping on theme switch
Builds on efforts brought forward in #17979.

This will send sidebars through three levels of mapping:

1. If both themes have only one sidebar, that gets mapped.
2. If both themes have sidebars with the same slug, they get mapped.
3. Sidebars that (even partially) match slugs from a similar kind of sidebar will get mapped.

Finally, if the theme has previously been active and we have a record of its 
sidebar configuration then, any unmapped sidebar will be restored to its 
previous state.

Props westonruter, obenland, alexvorn2, timmydcrawford.
See #39693.


Built from https://develop.svn.wordpress.org/trunk@41555


git-svn-id: http://core.svn.wordpress.org/trunk@41388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 18:46:46 +00:00
Sergey Biryukov
c70492e5d1 Docs: Remove "in in", "this this", and "containing containing" dittography from inline comments.
Props Presskopp.
Fixes #41841.
Built from https://develop.svn.wordpress.org/trunk@41353


git-svn-id: http://core.svn.wordpress.org/trunk@41186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-09 13:19:45 +00:00
Sergey Biryukov
098fed18b7 Docs: Remove "the the" dittography from inline comments.
Props Presskopp.
Fixes #41835.
Built from https://develop.svn.wordpress.org/trunk@41350


git-svn-id: http://core.svn.wordpress.org/trunk@41183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-08 18:21:42 +00:00
Konstantin Obenland
e183d59acb Map nav menu locations on theme switch
This will send nav menu locations through three levels of mapping:
1. If both themes have only one location, that gets mapped.
2. If both themes have locations with the same slug, they get mapped.
3. Locations that (even partially) match slugs from a similar kind of menu location will get mapped.

Menu locations are mapped for Live Previews in the Customizer and during theme switches.

Props westonruter, obenland, welcher, melchoyce.
Fixes #39692.


Built from https://develop.svn.wordpress.org/trunk@41237


git-svn-id: http://core.svn.wordpress.org/trunk@41077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-09 21:04:47 +00:00
John Blackbourn
b140e8f574 General: Fix various instances of incorrect filter docs and incorrect filter and action parameters.
Props keesiemeijer for identifying the issues

See #38462

Built from https://develop.svn.wordpress.org/trunk@41219


git-svn-id: http://core.svn.wordpress.org/trunk@41059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 15:43:43 +00:00
Weston Ruter
a193916f46 Customize: Introduce settings_previewed arg and getter on WP_Customize_Manager which controls whether WP_Customize_Setting::preview() should be called on settings.
The `settings_previewed` property eliminates the need for the Customizer components from having to look at global `doing_ajax` state. This is in particular needed when saving settings, as some settings will short-circuit the update operation if they detect no changes are introduced. This is also needed for low-level integrations with the Customizer, such as in REST API endpoints under development.

Props stubgo, westonruter, utkarshpatel for testing.
See #38900.
Fixes #39221.

Built from https://develop.svn.wordpress.org/trunk@41205


git-svn-id: http://core.svn.wordpress.org/trunk@41045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-02 05:35:41 +00:00
Drew Jaynes
8fd5ec4e62 Docs: Use a third-person singular verb in the summary for _wp_customize_publish_changeset().
Also adding missing `@since` and `@access` tags. Introduced in 4.7, see [38810].

See #41017.

Built from https://develop.svn.wordpress.org/trunk@41193


git-svn-id: http://core.svn.wordpress.org/trunk@41033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-30 15:34:42 +00:00
Drew Jaynes
6ce9846893 Docs: Document use of the $wpdb and $wp_customize globals in _wp_customize_publish_changeset().
Props sagarladani for the initial patch.
Fixes #41479.

Built from https://develop.svn.wordpress.org/trunk@41192


git-svn-id: http://core.svn.wordpress.org/trunk@41032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-30 15:31:42 +00:00
John Blackbourn
219de8acd5 General: Avoid counting uncountable values when reading theme directories, and in some unit tests.
See #40109

Built from https://develop.svn.wordpress.org/trunk@41174


git-svn-id: http://core.svn.wordpress.org/trunk@41014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 17:00:44 +00:00
Drew Jaynes
8c7f5367c0 Docs: Remove some more top-level @aacess tags from function DocBlocks.
See #414532.

Built from https://develop.svn.wordpress.org/trunk@41168


git-svn-id: http://core.svn.wordpress.org/trunk@41008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 08:19:43 +00:00
Weston Ruter
8648fc0bff Customize: Update Text widget starter content to utilize visual mode.
Amends [38991].
Props dlh, westonruter.
See #35243, #38114.
Fixes #41410.

Built from https://develop.svn.wordpress.org/trunk@41136


git-svn-id: http://core.svn.wordpress.org/trunk@40976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-24 23:25:44 +00:00
Weston Ruter
d8f94986b2 Customize: Keep alive auto-drafts created for page/post stubs when parent changeset is updated, and delete when changeset is garbage-collected.
Props utkarshpatel, westonruter.
See #31089.
Fixes #39715.

Built from https://develop.svn.wordpress.org/trunk@40676


git-svn-id: http://core.svn.wordpress.org/trunk@40539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-16 05:37:44 +00:00
Weston Ruter
fc631ffa00 Customize: Trailingslash the home nav menu item URL in starter content.
This prevents an additional 301 redirect when clicking on the nav menu item, and it also prevents a scenario where the auth cookie may not be passed and cause an authentication error when navigating in the customizer.

Props dlh, swissspidy.
Fixes #40112.

Built from https://develop.svn.wordpress.org/trunk@40300


git-svn-id: http://core.svn.wordpress.org/trunk@40207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-18 03:23:44 +00:00
Dion Hulse
2808758334 Customize: Update the introduced version in the docs for the get_header_video_url filter to 4.7.3.
See #39512.

Built from https://develop.svn.wordpress.org/trunk@40086


git-svn-id: http://core.svn.wordpress.org/trunk@40023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:48:08 +00:00
Sergey Biryukov
e29bbcd167 Docs: Use third-person singular verb for wp_get_custom_css filter description.
See #39130.
Built from https://develop.svn.wordpress.org/trunk@40046


git-svn-id: http://core.svn.wordpress.org/trunk@39983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-06 02:57:42 +00:00
Sergey Biryukov
a972390e61 Customize: Introduce get_header_video_url filter for the return value of get_header_video_url().
Props sanket.parmar, celloexpressions.
Fixes #39512.
Built from https://develop.svn.wordpress.org/trunk@40045


git-svn-id: http://core.svn.wordpress.org/trunk@39982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-06 02:52:41 +00:00
Sergey Biryukov
8b9a3a08bf Docs: After [37083], change "HEX format" to "3- or 6-digit hexadecimal form" for clarity.
Props swissspidy, theMikeD.
Fixes #36336.
Built from https://develop.svn.wordpress.org/trunk@39888


git-svn-id: http://core.svn.wordpress.org/trunk@39825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-12 05:56:40 +00:00
Sergey Biryukov
03c6dc1002 Customize: Correct a comment in get_theme_starter_content() added in [39561].
The item name is `link_home`, not `home_link`.

See #39104.
Built from https://develop.svn.wordpress.org/trunk@39751


git-svn-id: http://core.svn.wordpress.org/trunk@39689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-07 13:11:41 +00:00
Dion Hulse
9f381dbea6 Customizer: Don't query for postmeta for Custom CSS (for not-current-themes) and Customizer Changeset posts.
Props dlh.
Fixes #39194.

Built from https://develop.svn.wordpress.org/trunk@39692


git-svn-id: http://core.svn.wordpress.org/trunk@39632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 08:12:42 +00:00
Weston Ruter
2ed703ed78 Customize: Ensure theme_mod-cache of custom_css lookup of -1 short-circuits a WP_Query from being made.
Props dlh.
See #35395.
Fixes #39259.

Built from https://develop.svn.wordpress.org/trunk@39688


git-svn-id: http://core.svn.wordpress.org/trunk@39628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 07:13:42 +00:00
Sergey Biryukov
7a83036227 Docs: Correct the DocBlock for get_header_video_url().
Props keesiemeijer.
Fixes #39468.
Built from https://develop.svn.wordpress.org/trunk@39676


git-svn-id: http://core.svn.wordpress.org/trunk@39616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-04 13:44:43 +00:00
Weston Ruter
57830bf2be Customize: Deprecate page_home nav menu item starter content in favor of home_link; replace usage in Twenty Seventeen.
Props celloexpressions, westonruter.
Amends [38991].
See #38615, #38114.
Fixes #39104.

Built from https://develop.svn.wordpress.org/trunk@39561


git-svn-id: http://core.svn.wordpress.org/trunk@39501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-10 23:39:43 +00:00
Weston Ruter
592c3fc7d7 Customize: Use esc_url_raw() instead of wp_json_encode() to eliminate extraneous slashes when outputting background image URL in CSS url().
Props tyxla, westonruter.
See #22058.
Fixes #39145.

Built from https://develop.svn.wordpress.org/trunk@39546


git-svn-id: http://core.svn.wordpress.org/trunk@39486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-09 01:43:42 +00:00
Weston Ruter
0a31089bf6 Customize: Ensure a custom_css post insertion gets an initial post revision.
Props georgestephanis, westonruter.
See #30854, #38672, #35395.
Fixes #39032.

Built from https://develop.svn.wordpress.org/trunk@39477


git-svn-id: http://core.svn.wordpress.org/trunk@39417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-04 17:31:33 +00:00
Weston Ruter
456941a018 Customize: Refactor logic for updating custom_css posts by introducing wp_update_custom_css_post() function and renaming update filter.
* Moves logic from `WP_Customize_Custom_CSS_Setting::update()` into a re-usable `wp_update_custom_css_post()` function, useful for future REST API endpoint, WP-CLI command, or plugin migrations.
* Renames `customize_update_custom_css_post_content_args` filter to `update_custom_css_data` and improves the naming of the parameters. Instead of passing `post_content` and `post_content_filtered` the filtered array now contains `css` and `preprocessed` respectively. 
* The second context param for the `update_custom_css_data` filter is now an array of the original args passed to `wp_update_custom_css_post()` and there is now no more `$setting` arg since it isn't necessarily being called in the customizer context.

Props westonruter, georgestephanis.
See #35395.
Fixes #38672.

Built from https://develop.svn.wordpress.org/trunk@39350


git-svn-id: http://core.svn.wordpress.org/trunk@39290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 17:34:31 +00:00
Helen Hou-Sandí
70fc99e323 Theme starter content: Add support for featured images and page templates.
Featured image support means that attachments can now be imported. Media can be sideloaded from within theme or plugin directories. Like other posts, attachments are auto-drafts until customizer changes are published, and are not duplicated when they already exist in the customized state. Attachment IDs can be used for any number of purposes, much like post IDs. Twenty Seventeen now includes 3 images used as featured images to best showcase the multi-section homepage setup.

As featured image IDs are stored in post meta, it also made sense to add support for page templates. Twenty Seventeen does not include any such templates, but the functionality can be quite important for displaying themes to their best effect.

props westonruter, helen, flixos90.
fixes #38615.

Built from https://develop.svn.wordpress.org/trunk@39346


git-svn-id: http://core.svn.wordpress.org/trunk@39286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 09:53:33 +00:00
Peter Wilson
0b8740d868 Themes: Prevent unneeded database updates in wp_get_custom_css_post().
When a custom header image was set but custom CSS was not, `wp_get_custom_css_post()` was generating an UPDATE query on every frontend request.

In theme options the header image meta data is stored as an object. In `update_option()` this hits an edge case as the resource IDs of the old and new values never match.

This changes the logic of `wp_get_custom_css_post()` to ensure `set_theme_mod()` is only called when the custom CSS has changed.

Props bradyvercher, helen.
Fixes #38866.

Built from https://develop.svn.wordpress.org/trunk@39338


git-svn-id: http://core.svn.wordpress.org/trunk@39278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-22 11:41:34 +00:00
Weston Ruter
2cabe7aef1 Customize: Add unit tests for importing theme starter content.
Props welcher, westonruter.
See #38114, #38533, #38615.
Fixes #38540.

Built from https://develop.svn.wordpress.org/trunk@39276


git-svn-id: http://core.svn.wordpress.org/trunk@39216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 08:18:32 +00:00
Joe McGill
5ef714db18 Themes: Improve a11y and extendability of custom video headers.
This adds play/pause controls to video headers, along with voice
assistance, using `wp.a11y.speak`, to make custom video headers more
accessible. To make styling the play/pause button easier for themes,
CSS has been omitted from the default implementation.

This also includes a refactor of the `wp.customHeader` code to introduce
a `BaseHandler` class, which can be extended by plugins and themes to modify
or enhance the default video handlers.

Props davidakennedy, afercia, bradyvercher, joemcgill, adamsilverstein, rianrietveld.
Fixes #38678.
Built from https://develop.svn.wordpress.org/trunk@39272


git-svn-id: http://core.svn.wordpress.org/trunk@39212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 23:26:31 +00:00
Helen Hou-Sandí
2d9ac64c9f Theme starter content: Add reference IDs for most default widgets.
Some widgets that require more configuration are not included, such as RSS and Custom Menu. Tag Cloud is also not included because fresh sites do not have any tags to display.

Also adds a search widget to a Twenty Seventeen footer widget area.

see #38615.

Built from https://develop.svn.wordpress.org/trunk@39261


git-svn-id: http://core.svn.wordpress.org/trunk@39201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 00:40:32 +00:00
Helen Hou-Sandí
fd761208fc Theme starter content: Refine the content for pages.
see #38615.

Built from https://develop.svn.wordpress.org/trunk@39260


git-svn-id: http://core.svn.wordpress.org/trunk@39200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 00:29:31 +00:00
Helen Hou-Sandí
d4603ec9b7 Theme starter content: Add more social link items to select from.
New: Foursquare, GitHub, LinkedIn, Pinterest, and YouTube. They are also now all alphabetized.

see #38615.

Built from https://develop.svn.wordpress.org/trunk@39256


git-svn-id: http://core.svn.wordpress.org/trunk@39196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 21:20:31 +00:00
Helen Hou-Sandí
8485582c8a Theme starter content: Revamp the credits widget into an about widget.
The credits widget from the original commit was a nice test to see the date changing, but isn't really very inspirational. Also, implement it in Twenty Seventeen.

see #38615.

Built from https://develop.svn.wordpress.org/trunk@39255


git-svn-id: http://core.svn.wordpress.org/trunk@39195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 21:08:30 +00:00
Weston Ruter
8efc416f64 Customize: Allow starter content to apply in a new theme when switching from another theme containing changes.
* Ensure that starter content can apply from theme B after previewing starter content in theme A.
* Introduce new `starter_content` flag in changeset setting params which is used to capture whether a value is starter content and thus can be overridden.
* Create changeset up-front with `starter_content` flags instead of waiting for `AUTOSAVE_INTERVAL`.
* Eliminate instantiation of settings for widget instances in favor of directly calling `sanitize_widget_js_instance`. This eliminates issues with looking for widgets before they are registered.
* Ensure that non-placeholders (inline arrays instead of string references) can be supplied in starter content.
* Re-use auto-draft posts as starter content across theme switches.
* Introduce `starter_content` param for `WP_Customize_Manager::save_changeset_post()` which is `false` except when starter content is being loaded on a `fresh_site`.

See #38114.
Fixes #38541.

Built from https://develop.svn.wordpress.org/trunk@39241


git-svn-id: http://core.svn.wordpress.org/trunk@39181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 09:03:32 +00:00
Peter Wilson
11998b4169 Themes: Remove front page restriction from video header functions.
Adds a callback for determining when video headers should be displayed in themes supporting custom headers. By default, video headers are only displayed on the front page of a site.

Theme authors may set a custom callback by passing `'video-active-callback' => 'mytheme_video_active_callback'` as an argument. The default callback is `is_front_page()`.

This introduces the new function `is_header_video_active()` - returns `true` on pages that should display video headers. The return value can be filtered using the new filter of the same name.

Props flixos90, bradyvercher, peterwilsoncc, joemcgill.
Fixes #38738.

Built from https://develop.svn.wordpress.org/trunk@39240


git-svn-id: http://core.svn.wordpress.org/trunk@39180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 07:16:33 +00:00
Helen Hou-Sandí
79cabf64b1 Theme starter content: Add context to all strings.
fixes #38770.

Built from https://develop.svn.wordpress.org/trunk@39231


git-svn-id: http://core.svn.wordpress.org/trunk@39171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-14 21:38:32 +00:00
Weston Ruter
dfbcdae985 Customize: Use selective refresh for custom header changes when possible.
* Use `postMessage` transport for header image settings by default when video headers are supported, and thus `the_custom_header_markup()` will necessarily be used (and thus a selective refresh partial will be available).
* Ensure that `the_custom_header_markup()` always outputs a container element in the customizer preview even if the header is empty.
* Ensure that edit shortcut appearing for custom header does not get positioned off-screen.

Props bradyvercher, westonruter.
See #38639.
Fixes #38737.

Built from https://develop.svn.wordpress.org/trunk@39227


git-svn-id: http://core.svn.wordpress.org/trunk@39167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-14 18:41:32 +00:00
Weston Ruter
e5b82c250f Customize: Improve extensibility of Custom CSS.
* Add `customize_value_custom_css` filter to `WP_Customize_Custom_CSS::value()` method.
* Introduce `customize_update_custom_css_post_content_args` filter in `WP_Customize_Custom_CSS::update()` method.
* Make clear that `wp_get_custom_css()` and `wp_get_custom_css` filter are specifically for obtaining the value to render/display. Eliminate use of `wp_get_custom_css()` when getting the setting value. Use the underlying `post_value` directly when `is_previewed`.
* Move anonymous functions handing JS previewing for `custom_logo`, `custom_css`, and `background` into named functions on the `wp.customize.settingPreviewHandlers` to allow plugins to override/extend preview logic.
* Update `_custom_background_cb` to always print a `style` tag wen in the customizer preview, and update background preview logic to replace existing style element instead of appending a new style to the head so that background changes don't unexpectedly override any Custom CSS in the preview's stylesheet cascade.

Props westonruter, georgestephanis.
See #22058.
Fixes #38672.

Built from https://develop.svn.wordpress.org/trunk@39209


git-svn-id: http://core.svn.wordpress.org/trunk@39149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-13 02:43:29 +00:00
Weston Ruter
ad80e08c17 Customize: Split out custom_css query logic from wp_get_custom_css() into a re-usable wp_get_custom_css_post() function to also be used when updating.
Props georgestephanis, westonruter.
See #38672, #35395.

Built from https://develop.svn.wordpress.org/trunk@39185


git-svn-id: http://core.svn.wordpress.org/trunk@39125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 20:43:30 +00:00
Weston Ruter
5b676af8ff Customize: Store modifying user ID with setting change written into changeset and restore current user when setting is being saved.
Restoring the current user context when saving a setting ensures filters apply as expected, such as Kses. When a user is not associated with a given setting change, continue to override `capability` to be `exist` when saving. Skip overwriting setting values in a changeset that have not changed, facilitating concurrent editing and amending a changeset by a user with fewer privileges.

See #30937.
Fixes #38705.

Built from https://develop.svn.wordpress.org/trunk@39181


git-svn-id: http://core.svn.wordpress.org/trunk@39121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 07:03:30 +00:00
Weston Ruter
5b633c548e Customize: Prevent post_content and post_name from being modified when trashing customize_changeset posts.
See #30937.
Fixes #38719.

Built from https://develop.svn.wordpress.org/trunk@39180


git-svn-id: http://core.svn.wordpress.org/trunk@39120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 05:45:32 +00:00
Joe McGill
5704743a78 Themes: Remove Vimeo logic from header_video_settings().
Following [39148] and [39128], this removes the mime type logic for
Vimeo URLs from `get_header_video_settings()` and removes remaining
Vimeo reference from `_validate_external_header_video()` docs.

Fixes #38544.
Built from https://develop.svn.wordpress.org/trunk@39165


git-svn-id: http://core.svn.wordpress.org/trunk@39105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 19:20:32 +00:00
Joe McGill
60db5df85f Themes: Improve reliability of URL used in get_header_image_tag().
`get_header_image_tag()` relies on the data returned by `get_custom_header()`
to build the attributes for the header `<img>` element. However,
`get_custom_header()` relies on data from the `header_image_data` theme
mod rather than the `header_image` theme mod that `get_header_image()` uses.
This can create inconsistencies when no header image is set, but a theme
supports a default header image.

This fixes the issue by making `get_custom_image_tag()` rely on the URL
returned by `get_header_image()` instead.

Props bradyvercher.
Fixes #38633.
Built from https://develop.svn.wordpress.org/trunk@39121


git-svn-id: http://core.svn.wordpress.org/trunk@39061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:09:02 +00:00