Commit Graph

559 Commits

Author SHA1 Message Date
Joe McGill 030bc377dd Themes: Enable video in custom headers.
This adds the ability for themes to add support for videos in custom headers
by passing `'video' => true` as an argument when adding theme support for
custom headers.

Custom video headers are managed through the “Header Visuals” (i.e. “Header Image”)
panel in the Customizer where you can select a video from the media library or set a
URL to an external video (YouTube for now) for use in custom headers.

This introduces several new functions:

`has_header_video()` – Check whether a header video is set or not.
`get_header_video_url()` – Retrieve header video URL for custom header.
`the_header_video_url()` – Display header video URL.
`get_header_video_settings()` – Retrieve header video settings.
`has_custom_header()` – Check whether a custom header is set or not.
`get_custom_header_markup()` – Retrieve the markup for a custom header.
`the_custom_header_markup()` – Print the markup for a custom header.

And a new file, `wp-includes/js/wp-custom-header.js` that handles loading videos
in custom headers.

This also enables video headers in the Twenty Seventeen and Twenty Fourteen themes.

Props davidakennedy, celloexpressions, bradyvercher, laurelfulford, joemcgill.
Fixes #38172.
Built from https://develop.svn.wordpress.org/trunk@38985


git-svn-id: http://core.svn.wordpress.org/trunk@38928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-27 21:51:31 +00:00
Weston Ruter a86496aea4 Customize: Improve custom background properties UI.
Introduces new control for managing the background position. Adds control for setting the `background-size`.

Props cdog, celloexpressions, grapplerulrich, MikeHansenMe, FolioVision, afercia, helen, melchoyce, karmatosed, westonruter, Kelderic, sebastian.pisula.
Fixes #22058.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 06:52:29 +00:00
Weston Ruter 1ccd9e7a6c Customize: Introduce custom CSS for extending theme styles.
* Custom CSS is associated with a given theme and is displayed in an inline `style` element at the `wp_head` hook after the `wp_print_styles` is called so that it overrides any enqueued stylesheets.
* A `wp_get_custom_css()` function is used for accessing the CSS associated with the current theme (or another theme) and a `wp_get_custom_css` filter for manipulating it.
* CSS is managed in customizer via a new "Additional CSS" section with a single `textarea` control. 
* `WP_Customize_Section::$description_hidden` is introduced for hiding extended descriptions in customizer sections behind a help toggle as done with panels.
* CSS is stored in a `custom_css` post type with the theme (stylesheet) slug as the `post_name`.
* `WP_Customize_Custom_CSS_Setting` is introduced to handle validation of CSS, previewing, and persisting the CSS to the `custom_css` post type.
* The `custom_css` setting is tied to a new `unfiltered_css` capability which maps to `unfiltered_html` by default.
* Escaping the message in the notification template is removed to allow markup (`code` tags) to be rendered.

See https://make.wordpress.org/core/2016/10/11/feature-proposal-better-theme-customizations-via-custom-css-with-live-previews/

Props johnregan3, celloexpressions, folletto, westonruter.
Fixes #35395.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 18:15:31 +00:00
Weston Ruter f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +00:00
Weston Ruter 76681c40e3 Customize: Opt to disable IE8 support via conditional comments instead of using unreliable `Array.prototype.indexOf` feature detection.
Deprecate/remove `WP_Customize_Manager::customize_preview_html5()` and remove `document.head` polyfill, both of which were only in place for IE8 support.

Props ryankienstra, westonruter.
Fixes #38021.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-25 04:35:32 +00:00
Weston Ruter 4c4271a691 Customize: Remove IE8 access to customizer to discontinue support.
Uses feature detection for `Array.prototype.indexOf` since it is not implemented in IE8.

Props ryankienstra.
See #38021.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 04:02:31 +00:00
Scott Taylor a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor 390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse 0e31a46161 Bootstrap: Revert [38399] as it's broken `/build/` and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor 6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Drew Jaynes 22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Jeremy Felt 6f3f00ea97 Multisite: Change `WP_Network` `id` property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Peter Wilson 47d26cd9fb DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993

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


git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Drew Jaynes 6d06e53dba Docs: Improve the DocBlock summary for `add_theme_support()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 00:07:30 +00:00
Drew Jaynes 6e8102dae6 Docs: Add documentation for the variadic second parameter, `$args`, accepted by `add_theme_support()`.
h/t kevinwhoffman
Fixes #37067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 00:03:28 +00:00
Drew Jaynes 916a055361 Docs: Improve documentation for the `$feature` parameter in the DocBlock for `add_theme_support()`.
See #32246. See #37067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-09 20:34:55 +00:00
Drew Jaynes 9193013158 Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

Fixes #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:02:28 +00:00
Drew Jaynes 136296c111 Docs: Standardize filter docs in wp-includes/theme.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:18:29 +00:00
Drew Jaynes f52a8cb1fa Docs: Remove/replace invalid inline `@link` tags in DocBlocks in wp-includes/*.
Fixes #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Drew Jaynes b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Rachel Baker ddbde15454 Post Thumbnails: Fix logic bug and tests from [37308] where post-thumbnails support wasn’t added if there were no previous post_types with support already.
See #22080
Built from https://develop.svn.wordpress.org/trunk@37313


git-svn-id: http://core.svn.wordpress.org/trunk@37279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-26 20:29:27 +00:00
Rachel Baker af5c5a9a25 Post Thumbnails: When using `add_theme_support( ‘post-thumbnails’, array( $post_types) )` merge the supported post_types.
Allow the adding of post-thumbnail support for one or more post_types without unsetting any previously added post_types. This matches the behavior of other uses of `add_theme_support()` and the expectations of a function with a prefix of “add”.
To unset post-thumbnail support use `remove_theme_support()` instead.

Fixes #22080

Props alexkingorg, jmichaelward, and flixos90.
Built from https://develop.svn.wordpress.org/trunk@37308


git-svn-id: http://core.svn.wordpress.org/trunk@37274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-26 17:05:31 +00:00
Aaron Jorbin c1d684383c Prevent PHP Warnings when using Custom Logo with no params
The parsing of defaults assumes that $args will be an array. This solves it for Custom Logo the same way it is solved for custom-header and custom-background.

Props obenland.
Fixes #36332.


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


git-svn-id: http://core.svn.wordpress.org/trunk@37059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-30 02:22:26 +00:00
Drew Jaynes cb457da489 Docs: Improve the DocBlocks for `get_header_textcolor()` and `header_textcolor()` to mention that they both retrieve color values in the HEX format.
Props theMikeD.
Fixes #36336.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-25 23:06:27 +00:00
Konstantin Obenland cbbf361c03 Customize: Bring custom-logo args closer to custom-header.
Allows themes to specify the desired width and height of logos, and whether
that is flexible or not. Has the benefit of not having to generate a logo-sized
file for every image uploaded.

Props westonruter, celloexpressions.
Fixes #36255.


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


git-svn-id: http://core.svn.wordpress.org/trunk@37044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-24 02:02:27 +00:00
Weston Ruter f3f84d2f21 Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-21 21:59:29 +00:00
Aaron Jorbin 1972aa2a2a Add grunt prerelease task
An unintended consequence of improving the precommit task is that when it's time to run a release, more tasks need to get run to verify things. This adds a prerelease task to help fix that situation. grunt prerelease should include tasks that verify the code base is ready to be released to the wild and find all the tears on the mausoleum floor and help Blood stain the Colosseum doors.

See #35557

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


git-svn-id: http://core.svn.wordpress.org/trunk@36898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 05:37:27 +00:00
Konstantin Obenland dabfefcee2 Themes: Support second argument in theme support for custom logo.
See #33755.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 21:51:27 +00:00
Dominik Schilling 3f3fe5a7ed Themes: Use the attachment ID as the key in `get_uploaded_header_images()`.
Prevents missing header images when an image has the same name as another header image.

Props sirbrillig.
Fixes #31786.
Built from https://develop.svn.wordpress.org/trunk@36539


git-svn-id: http://core.svn.wordpress.org/trunk@36506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 22:12:27 +00:00
Drew Jaynes deeb5f1471 Themes: Pass information about the old theme in the form of a `WP_Theme` object when the `switch_theme` action is fired.
Props MikeHansenMe.
See #22401.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 08:26:25 +00:00
Pascal Birchler fa9b71e423 Docs: Document the default value for the `$validate` parameter in the `validate_current_theme` hook docs.
See #32246.
Built from https://develop.svn.wordpress.org/trunk@35976


git-svn-id: http://core.svn.wordpress.org/trunk@35941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 20:10:25 +00:00
Pascal Birchler 4e6e728703 Docs: Correct a parameter name for the `validate_current_theme` filter.
See #32246.
Built from https://develop.svn.wordpress.org/trunk@35972


git-svn-id: http://core.svn.wordpress.org/trunk@35937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 19:36:28 +00:00
Pascal Birchler f522e69a57 Docs: Fix a typo in the `stylesheet_directory` filter docs.
Props ixkaito.
Fixes #34859.
Built from https://develop.svn.wordpress.org/trunk@35799


git-svn-id: http://core.svn.wordpress.org/trunk@35763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:57:24 +00:00
Konstantin Kovshenin 919867b090 Docs: Remove some more dittography.
See #34885, r35793.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:50:25 +00:00
Scott Taylor 79a2915a9b Upgrade: New themes are not automatically installed on upgrade. This can still be explicitly asked for by defining `CORE_UPGRADE_SKIP_NEW_BUNDLED` as `false`.
In `populate_options()`, if the theme specified by `WP_DEFAULT_THEME` doesn't exist, fall back to the latest core default theme. If we can't find a core default theme, `WP_DEFAULT_THEME` is the best we can do. 

Props nacin, jeremyfelt, dd32.
See #34306.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-25 21:45:25 +00:00
Andrew Ozz f34c16674a Responsive images: fix args order and streamline the srcset and sizes generation and better inline docs in `get_header_image_tag()`.
See #21389.
Built from https://develop.svn.wordpress.org/trunk@35595


git-svn-id: http://core.svn.wordpress.org/trunk@35559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-10 01:59:25 +00:00
Andrew Ozz a86cac1676 Responsive images: add template helper functions to generate the tag for a (responsive) header image that includes srcset and sizes attributes.
Props Otto42, joemcgill, DH-Shredder, azaozz.
Fixes #21389.
Built from https://develop.svn.wordpress.org/trunk@35594


git-svn-id: http://core.svn.wordpress.org/trunk@35558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-10 01:17:26 +00:00
Konstantin Obenland c69e96422b Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the
separator, and a way to short-circuit title generation. Plugins can now also
check for theme support and reliably filter the entire output. See #18548.
Deprecates `wp_title()`.

Fixes #31078.


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


git-svn-id: http://core.svn.wordpress.org/trunk@35260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 16:21:25 +00:00
Boone Gorges 0e7c1d3b14 Use `wp_installing()` instead of `WP_INSTALLING` constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34828


git-svn-id: http://core.svn.wordpress.org/trunk@34793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 15:06:28 +00:00
Weston Ruter aedb4c3ee2 Customizer: Flesh out phpdoc description for `_wp_customize_include()`.
Also add brackets around single-statement inline `if` statement.

Fixes #33488.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 19:36:25 +00:00
Aaron Jorbin c09b0477b2 Flush rewrite rules upon theme switch
Themes can ( and do ) but shouldn't include custom rewrite rules.This can lead to hard to debug issues for theme authors. Theme changes are not a ultra common conclusion. Flushing the rewrite rules on theme switch will lead to a clean slate for each theme which helps make debugging easier.

And @nacin said we should do this 5 years ago at WordCamp Mid Atlantic.

Fixes #14849


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


git-svn-id: http://core.svn.wordpress.org/trunk@33997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 23:50:24 +00:00
Konstantin Obenland 1e9372b699 Themes: Get the correct theme when template and stylesheet were both passed as arguments.
Fixes a bug where `$new_theme` got set before the second argument was
appropriately handled, causing the `current_theme` option to later always be
updated to the parent theme's name.

Introduced in [21131].

Props obenland, wonderboymusic.
Fixes #32635.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-30 21:45:23 +00:00
Scott Taylor 32110c7f77 Switching themes: if the new theme doesn't have `nav_menu_locations` defined, but the old theme does, copy the old theme's `nav_menu_locations` into the new theme's theme mods.
cc melchoyce

Fixes #18588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-30 03:01:21 +00:00
Scott Taylor 3d780c6a4b Clarify doc entry for `_wp_customize_include()`
Props ericlewis. 
Fixes #33488.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 17:45:25 +00:00
Dominik Schilling 8679a93f16 Themes: Remove legacy theme preview.
The pre-3.4 theme previewer doesn't work when using a static front page.
We kept the old theme preview for no-JS and some browsers that were less capable. But since browsers are doing a better job today we don't need to continue fixing/shipping this legacy code. Bye!

fixes #33178.
Built from https://develop.svn.wordpress.org/trunk@33492


git-svn-id: http://core.svn.wordpress.org/trunk@33459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 18:36:26 +00:00
Konstantin Obenland 080a4adfba Properly clean up header image data when the attachment is deleted.
Props CreativeInfusion.
Fixes #33005.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-15 16:28:25 +00:00
Drew Jaynes f4328b27b6 Add an extra line before the hook doc for the `editor_stylesheets` filter begins.
The parser really likes it when there's breathing room.

See [32928]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:01:24 +00:00
Konstantin Obenland 36b24b073d Provide alt text for uploaded header images.
The custom header screen will use it rather then the description,
if an alt text is set.

Props francoeurdavid, voldemortensen, valendesigns.
Fixes #27959.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-29 21:32:26 +00:00
Scott Taylor a0e373ef80 For doc block types, favor `bool` over the few remaining `boolean`s
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Sergey Biryukov 3f448d7cd5 Add `editor_stylesheets` filter to `get_editor_stylesheets()`.
props danielbachhuber, MikeHansenMe.
fixes #31672.
Built from https://develop.svn.wordpress.org/trunk@32928


git-svn-id: http://core.svn.wordpress.org/trunk@32899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-24 13:32:32 +00:00
Weston Ruter 489db97ea3 Customizer: Allow sections and panels to be exported to JS.
Also fix param docs for `customize_dynamic_setting_class` filter, and use `require_once` for `class-wp-customize-manager.php` in bootstrap function `_wp_customize_include()`.

See #30737, #32576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 22:54:25 +00:00
Scott Taylor 19a3aacc94 Add `@static*` annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Andrew Nacin 65c382d550 Fix `return` error in get_theme_mods() from [32629].
Split a line with both an assignment and a conditional, not to mention an interpolated variable. Lots going on, easy mistake to make.

props BrianLayman.
fixes #32516.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 05:51:25 +00:00
Scott Taylor b4eccbd5a0 Add missing doc blocks to `theme.php`.
Correct some `@return` values.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 22:21:25 +00:00
Drew Jaynes 44289a8ac5 Add a missing return description for `has_header_image()`.
See [31224]. See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 17:11:28 +00:00
Dominik Schilling 2ae3dfa119 Customizer: Add title attributes to iframes.
props afercia.
fixes #31202.
Built from https://develop.svn.wordpress.org/trunk@31704


git-svn-id: http://core.svn.wordpress.org/trunk@31685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 21:20:26 +00:00
Scott Taylor 0ec87e4584 There are a few functions that have the ability to return `false` instead of a string, so the return value should be checked before being passed to functions that expect string.
These are trivial, but they clear out some Scrutinizer issues.

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:11:28 +00:00
Sergey Biryukov b87b8f2bb3 Introduce has_header_image() to check whether a header image is set.
props GunGeekATX, voldemortensen.
fixes #16268.
Built from https://develop.svn.wordpress.org/trunk@31224


git-svn-id: http://core.svn.wordpress.org/trunk@31205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-17 06:34:23 +00:00
Scott Taylor eeda68bbda Fix some erroneous `@param` annotations.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 22:44:25 +00:00
Scott Taylor fe6b5983df In PHP 5.0.0, `is_a()` became deprecated in favour of the `instanceof` operator. Calling `is_a()` would result in an `E_STRICT` warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Scott Taylor fc843ce4d0 There are some random `add_action()` and `add_filter()` calls littered around some files in `wp-includes/`. These should be moved to `wp-includes/default-filters.php` with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even `SHORTINIT` - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Scott Taylor 5eb5afac34 For clarity, initialize some arrays that previously were only assigned via short circuit in loops.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 22:47:22 +00:00
John Blackbourn fbb5c1f1f5 Improve the `doing_it_wrong()` text for `title-tag` theme support.
Props ocean90
Fixes #18548

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


git-svn-id: http://core.svn.wordpress.org/trunk@30777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-08 16:06:26 +00:00
Scott Taylor d097e7cf83 Improve the `@param` docs for `src/includes/theme.php` and `src/includes/update.php`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:44:22 +00:00
Drew Jaynes bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00
Scott Taylor 63c55ae93c Correct type in the doc block for `get_theme_support()`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 05:18:22 +00:00
Scott Taylor 3535af5b77 Correct the return value doc block for `get_theme_support()`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 05:17:23 +00:00
Drew Jaynes f8657d5890 Remove redundant and erroneous `@uses` tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
John Blackbourn 0f64edb657 Introduce a new means of outputting a `<title>` tag in the theme head. Requires a theme to add support by calling `add_theme_support( 'title-tag' )`. This is the first step in adding a more robust means of generating and outputting the title tag.
See #18548.
Props obenland, chrisbliss18, joostdevalk.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 21:12:22 +00:00
Gary Pendergast 007ec52958 Add `wp_json_encode()`, a wrapper for `json_encode()` that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:35:19 +00:00
Sergey Biryukov ed4a827365 Don't display Standard post format twice in the meta box if the theme unnecessarily mentions it in the add_theme_support() call.
props ptahdunbar, nacin, pushplaybang, obenland.
fixes #16555.
Built from https://develop.svn.wordpress.org/trunk@30038


git-svn-id: http://core.svn.wordpress.org/trunk@30038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-27 11:26:18 +00:00
Dominik Schilling 61819a36ea Customizer: Change instances of "Theme Customizer" to just "Customizer", as the Customizer isn't necessarily theme-specific.
Also capitalize "Customizer".
See also https://make.wordpress.org/core/2014/07/08/customizer-improvements-in-4-0/.

props studionashvegas, tareq1988.
fixes #29947.
Built from https://develop.svn.wordpress.org/trunk@29903


git-svn-id: http://core.svn.wordpress.org/trunk@29658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 17:21:19 +00:00
Sergey Biryukov bf856e3a62 Translate some previously untranslated _doing_it_wrong() messages.
props georgestephanis.
fixes #25614.
Built from https://develop.svn.wordpress.org/trunk@29840


git-svn-id: http://core.svn.wordpress.org/trunk@29604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 21:06:15 +00:00
Drew Jaynes e329b34f37 Fix a typo in the PHPDoc for `get_stylesheet()`.
Props lgedeon.
Fixes #28985.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-23 05:11:16 +00:00
Scott Taylor 021b07a161 Call `untrailingslashit()` when adding a theme directory in `register_theme_directory()`. This prevents double-slashing in generated URLs. Don't add a directory if it is already present.
Adds unit tests.
Props obenland, wonderboymusic.
Fixes #28662.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 23:07:15 +00:00
Scott Taylor 89d9bbd7f6 Make audio and video URLs/embed handlers work in `<iframe>`-sandbox'd MCE views.
Introduce:
`get_editor_stylesheets()`
`wp_media_mce_styles()`.

See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-15 21:51:15 +00:00
Drew Jaynes c5a59037f1 Inline documentation cleanup for 4.0 audit.
Various improvements:
* Adds `@see` reference for `wp_list_comments()` in 'wp_list_comments_args' filter docs, added in [28285]
* Various phpDoc tweaks for the 'run_wptexturize' filter docs, added in [28715]
* Sentence and wrapping changes for `is_https_url()`, added in [28894]
* Documents the `$args` parameter for `wp_dropdown_languages()`, added in [29007]
* Adds a period to the parameter description for `_update_posts_count_on_delete()`, added in [28835]
* Documents a global in `is_customize_preview()`, added in [28999]
* phpDoc tweaks, adds an access modifier for `wpdb::esc_like()`, added in [28711]

See #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:02:15 +00:00
Scott Taylor ef436cb6e0 Revert [28563]. See #18298.
Built from https://develop.svn.wordpress.org/trunk@29044


git-svn-id: http://core.svn.wordpress.org/trunk@28832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 18:07:16 +00:00
Helen Hou-Sandí b6d3c0841e Prompt the user before leaving the Customizer if they have unsaved changes. props westonruter. fixes #25439.
Built from https://develop.svn.wordpress.org/trunk@29025


git-svn-id: http://core.svn.wordpress.org/trunk@28813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:04:15 +00:00
Sergey Biryukov 7197468003 Add is_customize_preview(), a conditional function to check if the site is being previewed in the Customizer.
props sammybeats, mattwiebe.
fixes #23509.
Built from https://develop.svn.wordpress.org/trunk@28999


git-svn-id: http://core.svn.wordpress.org/trunk@28787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 16:17:15 +00:00
Scott Taylor b75c79500b Replaces all uses of `TEMPLATEPATH` and `STYLESHEETPATH` in core with `get_template_directory()` and `get_stylesheet_directory()`.
Add `@deprecated` annotations to `TEMPLATEPATH` and `STYLESHEETPATH` definitions.

Props obenland, aaroncampbell. 
Fixes #18298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-23 20:12:15 +00:00
Scott Taylor 49251efc74 In `wp-includes/theme.php`, `break` is unreachable after `return`.
See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-07 03:50:14 +00:00
Andrew Nacin 6b579e0d59 Customizer: Properly handle widget settings when activating a previewed theme.
props westonruter, ocean90, gcorne.
fixes #27767.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 22:46:16 +00:00
Drew Jaynes f13d04e5cf Clarify inline documentation for the 'html5' case and PHPDoc return in `add_theme_support()`.
Props jond3r.
Fixes #27278.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-31 22:20:16 +00:00
Andrew Nacin 7d3b9ccb22 Encode spaces in get_template_directory_uri() and get_stylesheet_directory_uri().
props SergeyBiryukov.
fixes #21969.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 13:07:14 +00:00
Andrew Nacin a1c08b7660 Custom backgrounds: Do not print the default background color when it has been saved to the DB.
props obenland.
fixes #22030.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 11:53:14 +00:00
Andrew Nacin e451a2def5 Clarify that unregister_default_headers() returns void in some situations. fixes #21876.
Built from https://develop.svn.wordpress.org/trunk@27575


git-svn-id: http://core.svn.wordpress.org/trunk@27418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 00:12:15 +00:00
John Blackbourn 944c629ace Use `wp_get_attachment_url()` instead of the GUID when getting header image URLs. Fixes #27222. Props Kopepasah.
Built from https://develop.svn.wordpress.org/trunk@27434


git-svn-id: http://core.svn.wordpress.org/trunk@27281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 15:55:15 +00:00
Andrew Nacin affd41046b In set_theme_mod() account for when there is no old value.
fixes #14721. see [27393].

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


git-svn-id: http://core.svn.wordpress.org/trunk@27249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 01:13:14 +00:00
Andrew Nacin 4c7c24ecbf Add a pre_set_theme_mod_$name filter to set_theme_mod().
This is modeled after pre_update_option_$option in update_option() and pre_set_transient_$transient in set_transient().

props obenland.
fixes #14721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-04 07:02:13 +00:00
Sergey Biryukov bb9114f554 Add boolean return values to require_if_theme_supports().
props jeffsebring, DrewAPicture.
fixes #26716.
Built from https://develop.svn.wordpress.org/trunk@27217


git-svn-id: http://core.svn.wordpress.org/trunk@27074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 22:11:14 +00:00
Drew Jaynes cd8cedc40d First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Andrew Nacin 9be4bd5720 Rename the new custom-background arguments passed to add_theme_support().
* background-position becomes default-position-x
 * background-attachment becomes default-attachment
 * background-repeat becomes default-repeat

These are in line with existing default-image and default-color arguments, and also makes the position argument unambiguous and forwards compatible.

fixes #20816.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-03 21:36:10 +00:00
Drew Jaynes 27edadb0fd Inline documentation for hooks in wp-includes/theme.php.
Props ShinichiN.
Fixes #25588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-01 17:24:11 +00:00
Jon Cave fd14a5df71 Allow customisation of theme mod defaults via custom-background theme support.
Give the power to theme authors to select defaults when registering
custom-background support.

Props obenland. Fixes #20816.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-24 14:05:10 +00:00
Dion Hulse 443aa35cfc Upgrader: Make clearing the Plugin and Theme update caches optional during install and upgrade proceedures. See #22704
Built from https://develop.svn.wordpress.org/trunk@25272


git-svn-id: http://core.svn.wordpress.org/trunk@25238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 01:33:09 +00:00
Andrew Nacin 71b640dfa4 add_theme_support( 'html5' ) now defaults to comment-list, comment-form, and search-form.
This was the implicit case in 3.6.0, modified in [25193].

see #24932.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 17:44:09 +00:00
Andrew Nacin e0d60de6ca Fix 'html5' theme support.
* Require it to have a second argument when adding.
 * Merge, rather than replace, on second add.
 * Make current_theme_supports() work when two arguments are passed.

Adds unit tests.

props nathanrice for initial patch.
see #24932 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-31 01:30:09 +00:00
Sergey Biryukov aadd546d48 Avoid PHP notices in get_sample_permalink() and get_sample_permalink_html(). Remove unused global reference. props ocean90. fixes #25005.
Built from https://develop.svn.wordpress.org/trunk@25028


git-svn-id: http://core.svn.wordpress.org/trunk@25015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-15 16:25:12 +00:00
Andrew Nacin dfb236ee00 Don't return false from search_theme_directories() when a single directory is not readable.
Issue a notice.

props csixty4.
fixes #24639.



git-svn-id: http://core.svn.wordpress.org/trunk@24976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 21:40:28 +00:00
Mark Jaquith c10737d0f6 Revert [23467]. Removes structured-post-format theme support.
see #23347, #24452. closes #24453.

git-svn-id: http://core.svn.wordpress.org/trunk@24386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-30 17:55:14 +00:00
Sergey Biryukov 183e0e25e5 Fix typos in phpdoc. props jcastaneda. fixes #24230.
git-svn-id: http://core.svn.wordpress.org/trunk@24147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-01 01:46:45 +00:00
Mark Jaquith 759b3f5e82 Fix redundant use of array_keys() around get_post_format_slugs().
props SergeyBirkukov, wonderboymusic. fixes #24089.

git-svn-id: http://core.svn.wordpress.org/trunk@24082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-25 03:06:31 +00:00
Mark Jaquith fec4b66f5b Sanity checks on image metadata to avoid warnings, etc.
fixes #23733. props wonderboymusic.

git-svn-id: http://core.svn.wordpress.org/trunk@23873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 20:51:35 +00:00
Sergey Biryukov aa842e13b1 Always escape the URL echoed by header_image(). fixes #23664.
git-svn-id: http://core.svn.wordpress.org/trunk@23633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-07 05:30:00 +00:00
Helen Hou-Sandí 7a21a5c0f6 Implement theme support for structured-post-formats, which will supercede theme support for post-formats. Usage is the same as declaring support for post-formats: `add_theme_support( 'structured-post-formats', array( 'quote', 'video' ) )`. Adding `structured-post-formats` support also adds `post-formats` support for the given format(s) underneath.
Declaring support for a given format indicates that the theme handles format-specific metadata; admin UI will not change based on theme-declared support of either variety as it did previously. If no `structured-post-formats` support is explicitly declared for a format, a post in that format will have fallback output utilizing that metadata applied. In this way, a theme can style core-provided output for a full post format experience without having to handle metadata in any way.

props nacin. see #23347.


git-svn-id: http://core.svn.wordpress.org/trunk@23467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-21 22:48:09 +00:00
Sergey Biryukov a0c84bc523 Properly check if the custom header/background has been initialized. fixes #23170. see #22246.
git-svn-id: http://core.svn.wordpress.org/trunk@23367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-01 20:33:27 +00:00
Helen Hou-Sandí b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
Andrew Nacin 622e48092c In get_custom_header(), support a default header that is registered using default-image but not register_default_headers(). fixes #22221.
git-svn-id: http://core.svn.wordpress.org/trunk@22669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 06:59:25 +00:00
Andrew Nacin 49a0dc9a27 In switch_theme(), make sure there are no residual template_root or stylesheet_root options remaining if there is only one theme root registered. see #22252.
git-svn-id: http://core.svn.wordpress.org/trunk@22545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-11 21:51:27 +00:00
Andrew Nacin a756c8bfcd Ensure $_wp_default_headers is set before iterating over it in get_custom_header(). props jeffsebring. fixes #22221.
git-svn-id: http://core.svn.wordpress.org/trunk@22544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-11 19:11:27 +00:00
Andrew Nacin e1f25c2c0e Allow get_custom_header() to handle a default registered header that has yet to be saved to the database. fixes #22221.
git-svn-id: http://core.svn.wordpress.org/trunk@22436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 20:12:47 +00:00
Andrew Nacin 2677205fba If we have not yet initialized the custom header/background, do not do extra removal in _remove_theme_support(). fixes #22246.
git-svn-id: http://core.svn.wordpress.org/trunk@22313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-26 04:17:25 +00:00
Andrew Nacin 602dd1a738 Revert [22274]. see #22246.
git-svn-id: http://core.svn.wordpress.org/trunk@22312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-26 04:16:49 +00:00
Ryan Boren c344ce9cfb Avoid notices in _remove_theme_support(). Props alex-ye, SergeyBiryukov. fixes #22246
git-svn-id: http://core.svn.wordpress.org/trunk@22274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-23 13:20:40 +00:00
Jon Cave 1191d63830 Prevent accidental body class concatenation by replacing (no-)customize-support with a space
The regular expression used by wp_customize_support_script() replaces all spaces
surrounding the matching class. This caused other classes to be merged together.

Props johnpbloch, SergeyBiryukov. Fixes #22103.


git-svn-id: http://core.svn.wordpress.org/trunk@22132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 14:58:12 +00:00
Andrew Nacin 1635740139 URL encode the theme stylesheet passed into wp_customize_url(). see #21749.
git-svn-id: http://core.svn.wordpress.org/trunk@21713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-03 23:58:30 +00:00
Ryan Boren c55cf716da Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 13:33:00 +00:00
Ryan Boren 446be3ee40 Use set_url_scheme() in _custom_background_cb() to properly set the scheme for the background image when is_ssl(). Props jkudish. fixes #18005
git-svn-id: http://core.svn.wordpress.org/trunk@21629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-27 20:25:53 +00:00
nacin 3a215028ea Allow switch_theme() to take a single $stylesheet argument.
It now effectively has two function definitions:
function switch_theme( $stylesheet )
function switch_theme( $template, $stylesheet )

fixes #21075.



git-svn-id: http://core.svn.wordpress.org/trunk@21131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 05:21:04 +00:00
nacin bb667710a6 When looking in a sub-directory of wp-content/themes for more themes, check
if that specific directory exists before looking inside of it for style.css.

This avoids warnings when open_basedir restrictions are in effect.

props goldenapples. see #20985 for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@21126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 03:36:03 +00:00
nacin 222425a917 Introduce wp_clean_themes_cache() for upgrades and testing. fixes #20954.
git-svn-id: http://core.svn.wordpress.org/trunk@21080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-14 14:24:25 +00:00
ryan efa75c5c96 Fallback to /themes when there is no theme root. Props duck_. see #20919
git-svn-id: http://core.svn.wordpress.org/trunk@21063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-12 15:57:11 +00:00
nacin 64b9b4f940 Do not specify background-image: none when a user removes a custom background
on a theme that has a default background image.

The onus is on the theme to omit the default background-image from style.css,
to allow the user to remove the default background image. Or, the theme can
specify a background-image for the body selector, as long as they then zero
it out for body.custom-background, like so:

{{{
body {
	background-image: url( ... );
}
body.custom-background {
	background-image: none;
}
}}}

This allows the theme to be compatible with the custom background feature
but also gracefully degrade if the background feature is disabled.

This is the same behavior as 3.3; setting a default image has simply been
made more prominent in 3.4. Reverts [21013], also parts of [21001].
see #20448 for change and discussion history.

see #20132, which will now be marked as invalid.

Also, per previous changes in #20448, the custom-background class should not
be shown when only a default color is in use.

fixes #20448.



git-svn-id: http://core.svn.wordpress.org/trunk@21054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-11 21:25:05 +00:00
ryan 07140847b2 Namespace the customize request arg to prevent collision with plugins and themes. Props nacin. fixes #20862
git-svn-id: http://core.svn.wordpress.org/trunk@21016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-07 01:29:57 +00:00
koopersmith 14f04132af Theme Customizer: Fix scrolling on iOS and Kindle Fire. props azaozz, helenyhou. fixes #20805.
Also fixes uploader UIs on iOS and Kindle Fire by improving wp.Uploader.
Adds mobile viewport specifications.
Moves scrollbar back to fixed positioning.


git-svn-id: http://core.svn.wordpress.org/trunk@21014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-06 21:45:17 +00:00
nacin 5cba80ee25 Add some comments to _custom_background_cb() to explain the logic. see #20448.
git-svn-id: http://core.svn.wordpress.org/trunk@21002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-05 18:44:31 +00:00
ryan 64e6663569 Fix removing the default background image for themes that hard-code the default in css. Honor the default background image for themes that do not provide a fallback in css.
* <style> will appear if there is a default image registered. This is the same as 3.3.
* If only a default color is registered, it still assumes it is in the stylesheet, and no <style> will appear. This is a change from 3.3.
* <style> will continue to appear as before if there is a custom background color or image. This is the same as 3.3.
* This then allows for a default background image with background-image: none, overriding style.css. This is new.

Props nacin
see #20448


git-svn-id: http://core.svn.wordpress.org/trunk@21001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-05 18:35:31 +00:00
ryan 0f1f59b092 Custom background fixes:
* Specify default background colors for the bundled themes.
* Change the default custom background callback to only operate on saved values, rather than default values.
* Prevent an unsaved default value from overriding a manually modified style.css file.

Props nacin, kobenland
fixes #20448


git-svn-id: http://core.svn.wordpress.org/trunk@20973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-01 20:31:50 +00:00
nacin 26e0d68be0 Theme Customizer: As customize.php without a theme parameter defaults to the current theme, update wp_customize_url() to make $stylesheet optional and update references for the current theme.
see #19910, #20751, #20575.



git-svn-id: http://core.svn.wordpress.org/trunk@20934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 15:32:05 +00:00
koopersmith 69c970a4a1 Hide 'Customize' toolbar item when customizer is not supported. fixes #20751, see #19910.
Removes script queue check for 'customize-loader' from wp_customize_support_script(), because we may want to check for customize-support on a page without the loader.


git-svn-id: http://core.svn.wordpress.org/trunk@20918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 22:26:00 +00:00
koopersmith a5ee470df7 Theme Customizer: Improve default background property handling. see #20600, #19910.
If the custom background default wp-head-callback (_custom_background_cb) is used, we use postMessage for all custom background properties. Otherwise, we use full refreshes.

When using postMessage, the preview recalculates the custom background CSS block, allowing it to omit CSS values when they are not present and fall back on the original CSS.


git-svn-id: http://core.svn.wordpress.org/trunk@20908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 18:41:22 +00:00
nacin afad27974e Preview by default the registered default image for custom backgrounds. props mfields, billerickson.
If there is a default color registered, show a 'Default' action rather than a 'Clear' action, as clearing the value would simply return to the default.

Make current_theme_supports() accept a second argument for 'custom-background' requests, the same as get_theme_support(). Missed in earlier changes, see #20249.

fixes #20734, fixes #18041.



git-svn-id: http://core.svn.wordpress.org/trunk@20901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 17:58:57 +00:00
koopersmith d8abece877 Theme Customizer: Add CORS checks to the initial check for customize support. Prevents flash of customize links on large pages. see #20582, #19910.
Add wp_customize_support_script(), to quickly alter the body class based on whether customize is supported.


git-svn-id: http://core.svn.wordpress.org/trunk@20893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 00:15:12 +00:00
koopersmith 2f09b8d0a6 Theme Customizer: Fix hash-based loader fallbacks. see #20736, #19910, [20886].
git-svn-id: http://core.svn.wordpress.org/trunk@20890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 22:45:27 +00:00
koopersmith c3e7ce5320 Theme Customizer: Check for CORS support when the preview and admin urls are cross-domain. Add a fallback to the customize control frame, and check support there as well. see #20582, #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 21:13:21 +00:00
koopersmith 4973f92107 Theme Customizer: Change 'Return to...' link to 'Cancel' and move 'Save' button to header. props helenyhou, fixes #20692, see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 03:29:51 +00:00
nacin 95e1c32720 Customize API shuffling.
* Rename WP_Customize to WP_Customize_Manager.
 * Move customize-controls.php to wp-admin/customize.php.
 * Make customize.php the formal entry point, rather than admin.php?customize=on.
 * Rename is_current_theme_active() to is_theme_active().
 * Add getters for the theme, settings, controls, and sections properties.
 * Allow customize.php (no ?theme=) to load the active theme. Not used yet.
see #20736.



git-svn-id: http://core.svn.wordpress.org/trunk@20852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-23 17:56:42 +00:00
koopersmith bc99ad372e Theme Customizer: Properly change state when theme is switched. fixes #20610, see #19910.
* Causes the Manage Themes page to refresh if the customizer is closed after the active theme is switched.
* Changes the text of the 'Save and Activate' button once the theme has been activated.
* Improves the naming of the customize control settings.
* Add events to customize.Loader and make callbacks more flexible.
* Makes the customize-loader l10n compatible with non-admin settings.
* Adds WP_Customize->is_current_theme_active().
* Minor style corrections, including jQuery.attr/prop changes.



git-svn-id: http://core.svn.wordpress.org/trunk@20802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-16 05:55:54 +00:00
nacin eff63ef3f0 display_header_text() should only return true if the theme mod value is not 'blank'. An empty string is valid -- there is no requirement for it to be truthy. see #18887. see #20600.
git-svn-id: http://core.svn.wordpress.org/trunk@20772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-11 19:55:07 +00:00
nacin 15b661ecab Make admin-head-callback optional for custom headers. Reverts part of [20684]. fixes #20603.
git-svn-id: http://core.svn.wordpress.org/trunk@20712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-03 13:30:55 +00:00
nacin a5a40528c2 Require both wp-head-callback and admin-head-callback for custom header theme support. fixes #20603.
git-svn-id: http://core.svn.wordpress.org/trunk@20684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 15:16:48 +00:00
nacin 7ae297b910 Undeprecate require_if_theme_supports() for themes using it for legitimate reasons. see [20610]. props scribu, jkudish. fixes #20556.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-30 02:02:11 +00:00
nacin ace51e5f6d Deprecate require_if_theme_supports(). Always require post-thumbnail-template.php. fixes #20556. fixes #20409.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-27 04:54:36 +00:00
nacin 981a426119 Initialize the WP_Customize class in a prefixed global. props mattonomics. fixes #20465.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-25 21:30:02 +00:00
nacin fe63ec5dec If a cached theme root is no longer registered, skip it. Assume the cache is out of date. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-20 13:22:54 +00:00
nacin abd8d6a4c2 Always return a WP_Theme object from wp_get_theme(). If we can't find the theme root, assume the default theme root. (Which will probably result in a WP_Theme object that returns false for the exists() method, which is fine.) see #20361.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-19 03:33:42 +00:00
koopersmith 73246fa076 Theme Customizer: Remove unused 'template' argument from wp_customize_url. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-18 20:57:06 +00:00
nacin 9df0620d89 Move to admin.php?customize=on&theme=$stylesheet, rather than juggling both template and stylesheet values. see #19910.
Combine the setup_theme() and customize_previewing() methods. Remove the set_template() and set_stylesheet() methods. Add set_theme() method to WP_Customize to store the working WP_Theme object. We will use this for the stylesheet and template.

Use the WP_Theme display() method when preparing headers for display, not get() or the deprecate properties.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-17 21:43:47 +00:00
koopersmith e11cc3ec4f Theme Customizer: Integrate with browser history. Use window.history by default, with window.onhashchange as a fallback. fixes #20337, see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 23:07:23 +00:00
nacin aab399efbc Theme Customizer: Stick to wp_customize_url() instead of wp_customize_href(). Switch argument order so it is stylesheet-template. (Template is hypothetically optional, but the function will not support that.) see #19910.
Move to ->display('Name'), as ->get('Name') is a raw, untranslated version of the header.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 14:36:47 +00:00
koopersmith a5dacf7da5 Theme Customizer: Allow the customize iframe to be accessed directly (with full feature support). see #19910.
* Move the 'Return to Manage Themes' and 'Collapse Sidebar' actions from themes.php to customize-controls.php.
* Create a postMessage connection between themes.php and customize-controls.php.
* Allow the theme customizer to be accessed directly (independent of themes.php and the customize loader).
* Add wp_customize_href() and wp_customize_url().
* Remove wp_customize_loader(). To include the loader, use wp_enqueue_script( 'customize-loader' ).
* The theme customizer now requires postMessage browser support.
* Add .hide-if-customize and .hide-if-no-customize CSS classes.
* Clean up customize-preview.js.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 14:02:28 +00:00
koopersmith c2fb0c425b Replace all instances of thickbox theme preview with the theme customizer. fixes #20404.
* Use theme customizer in theme install/update screens.
* Separate the customize loader from the customizer. Use wp_customize_loader() to include the loader script and markup.
* Deprecated: wp-admin/js/theme-preview.js is now no longer used by core.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-10 02:25:03 +00:00
nacin a64c918e67 Internally cache themes inside wp_get_themes() by theme_root as well as stylesheet, to avoid conflicts with future calls to wp_get_themes(). Always return only the last stylesheet found, as before. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 20:38:42 +00:00
nacin a54b4f9c9e Always return a WP_Theme object from wp_get_theme(). Check \$theme->exists() or \$theme->errors() to confirm the requested theme actually exists. see #20361.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-05 01:05:49 +00:00
westi fba41a5b3a Avoid fatal errors in check_theme_switched() if we fail to get a WP_Theme object for the old theme. Fixes #20334.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-30 15:13:12 +00:00
nacin 70aa7f9607 Clear theme cache after editing. Reduce default cache persistence to 1800. (Could go lower.) see #20331.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-30 14:39:05 +00:00
nacin bb4cca4c55 Introduce WP_Theme->exists() to check if the queried theme actually exists. WP_Theme->exists() is a subset of errors() -- a theme with errors may still exist, but a theme that does not exist has an error of theme_not_found. wp_get_theme() now returns false if the theme does not exist. Improve scandir() and get_files() logic. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 02:59:48 +00:00
nacin 2c016a5a1c Deprecate get_theme_data(). Use wp_get_theme() instead. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 10:21:24 +00:00
nacin f60b0a2af3 Introduce display_header_text(). props chipbennett for initial patch. see #18887.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 18:48:57 +00:00
nacin f248632c42 WP_Theme::get_allowed_on_network() doesn't take a blog_id argument. props duck_. Restore static declaration accidentally removed in [20193]. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 17:32:28 +00:00
nacin 359ed454b7 Callbacks for custom headers and custom backgrounds registered through add_theme_support() are now wp-head-callback, admin-head-callback, and admin-preview-callback. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 03:36:17 +00:00
nacin 369fca1509 In new add_theme_support() logic, fix logic inversion, define HEADER_IMAGE in a simpler way, and force args to be an array. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-20 20:34:49 +00:00
nacin 4d3e562dd4 Deprecate add_custom_image_header(), remove_custom_image_header(), add_custom_background(), remove_custom_background(). Replacements are add_theme_support() and remove_theme_support(). see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 21:14:41 +00:00
nacin 127632b10d The word 'support' does not have a overly long 'p'. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 18:00:27 +00:00
nacin 3c2a88d91e Fix copy-paste issue. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 17:15:30 +00:00
nacin 6593186cb7 Introduce new registration methods for custom headers and custom backgrounds. Backwards compatible, but old methods will be deprecated. see #20249. see #17242.
Custom header: Use add_theme_support('custom-header', $args) instead of add_custom_image_header(). Deprecates all use of constants.
 * HEADER_TEXTCOLOR is now (string) 'default-text-color'.
 * NO_HEADER_TEXT is nowi ! (bool) 'header-text'.
 * HEADER_IMAGE_WIDTH (and _HEIGHT) are now (int) 'width' and 'height'.
 * HEADER_IMAGE is now (string) 'default-image'.
 * The 3.4 arguments 'suggested-width' and 'suggested-height' are now just 'width' and 'height' (they are "suggested" when flex-width and flex-height are set).
 * Callback arguments for add_custom_image_header() can now be passed to add_theme_support().

Custom background: Use add_theme_support('custom-background, $args) instead of add_custom_background(). Deprecates all use of constants.
 * BACKGROUND_COLOR is now (string) 'default-color'.
 * BACKGROUND_IMAGE is now (string) 'default-image'.
 * Callback arguments for add_custom_background() can now be passed to add_theme_support().

Inheritance: add_theme_support() arguments for custom headers and custom backgrounds is a first-one-wins situation. This is not an unusual paradigm for theming as a child theme (which is included first) overrides a parent theme.
 * Once an argument is explicitly set, it cannot be overridden. You must hook in earlier and set it first.
 * Any argument that is not explicitly set before WP is loaded will inherit the default value for that argument.
 * It is therefore possible for a child theme to pass minimal arguments as long as the parent theme specifies others that may be necessary.
 * Allows for a child theme to alter callbacks for <head> and preview (previously, calling add_custom_image_header more than once broke things).
 * The just-in-time bits ensure that arguments fall back to default values, that the values of all constants are considered (such as one defined after an old add_custom_image_header call), and that all constants are defined (so as to be backwards compatible).

get_theme_support(): Introduce new second argument, which headers and backgrounds leverage to return an argument. current_theme_supports() already supported checking the truthiness of the argument.
 * For example, get_theme_support( 'custom-header', 'width' ) will return the width specified during registration.
 * If you had wanted the default image, use get_theme_support( 'custom-header', 'default-image' ) instead of HEADER_IMAGE. 

Deprecate remove_custom_image_header(), remove_custom_background(). Use remove_theme_support('custom-header'), 'custom-background'.

Deprecate short-lived custom-header-uploads internal support; this is now (bool) 'uploads' for add_theme_support().

New 3.4 functions renamed or removed: Rename get_current_header_data() to get_custom_header(). Remove get_header_image_width() and _height() in favor of get_custom_header()->width and height.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 17:12:44 +00:00
nacin 962fae26f4 Updates to WP_Theme, wp_get_themes(), and related deprecated functions, after [UT570] [UT578] [UT579]. see #20103.
* ['Template Files'] and ['Stylesheet Files'] need to return files from the parent theme as well.
 * Don't strip links from the Author header. Some themes rely on the previous behavior, such as to link multiple authors (Sandbox, for example.) Don't restore links to the Name, that's just a bad idea.
 * Ensure we are always passing around arrays in get_files/scandir.
 * Better inline doc for wp_get_themes() arguments.
 * Introduce a 'force' flag for search_theme_directories() to re-scan, rather than return the cache. We will use this to re-build the theme_roots transient in get_theme_roots(), but it is more helpful for unit tests. Since search_theme_directories() is cached, don't cache again in wp_get_themes(). (Again benefits testing.)
 * Handle duplicate theme names in the old get_themes() when two themes match (and neither are a default theme, which is already handled). wp_get_themes() will consider both names to be the same; this is just for back compat since get_themes() is keyed by name.
 * Include an old array key in wp_broken_themes().



git-svn-id: http://svn.automattic.com/wordpress/trunk@20193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 15:39:21 +00:00
nacin 69447d2e89 Store stylesheet rather than theme name in the theme_switched option. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 21:22:24 +00:00
nacin ead3f2f435 Pass WP_Theme->get_theme_root_uri() to get_theme_root_uri(), thereby always triggering the theme_root_uri filter. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 18:18:10 +00:00
nacin c5d5d2f13f Use correct variable. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 18:00:11 +00:00
nacin d3487222d5 In wp_get_themes() under multisite, filter out allowed themes before creating WP_Theme objects, rather than after. search_theme_directories() provides us the stylesheet of each theme which is all we need to do the proper intersection. This results in major performance gains on sites that have large numbers of themes unavailable to them. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 07:46:39 +00:00
nacin 282deeec22 Store relative-to-wp-content theme roots, as that is what get_theme_roots() should be receiving. see #20103.
Since search_theme_directories() now generates this and leverages this as a cache, convert absolute to relative on cache storage, and relative to absolute on cache retrieval.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-06 01:50:54 +00:00
nacin b53c996068 Cast $wp_theme_directories to array. This had been done in get_themes(). A must-loaded plugin could call these functions before the first theme root is ever added. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-05 17:30:09 +00:00
azaozz dd45b9c2ca Don't pass non-existing rtl stylesheet to TinyMCE, update phpdoc for add_editor_style(), see #19437
git-svn-id: http://svn.automattic.com/wordpress/trunk@20059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-01 00:18:26 +00:00
nacin 71aa5ca72a Strict comparisons for the $allowed arg for wp_get_themes(). Otherwise 'network' does == true. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 23:04:25 +00:00
nacin a8d45a288f Deprecate get_current_theme(). Use (string) wp_get_theme() to get the translated name of the theme. Keep the current_theme option for now. see #20103, see #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 20:07:22 +00:00
nacin b599bef67a Update switch_theme() to use wp_get_theme(). see #20103, #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 05:09:29 +00:00
nacin d130a63e25 Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
 * Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
 * Error Handling: Broken themes have a WP_Error object attached to them.
 * Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
 * Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
 * i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
 * PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.

Functions deprecated:
 * get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
 * get_theme() and current_theme_info() -- use wp_get_theme()
 * get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
 * wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()

see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.

see #20103.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 21:24:44 +00:00
nacin 0cb8aed823 Theme root transient caching is now in search_theme_directories(), not get_themes(). see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:08:08 +00:00
nacin c77de588d4 Rewrite search_theme_directories() -- better performance and allow for caching.
* Update it to use PHP5 scandir().
 * Don't scan individual theme dirs -- we only need to check for style.css. (Solid performance gains.)
 * Improve and simplify branching.
 * Introduce wp_cache_themes_persistently filter to enable persistent caching of the return value, based on the theme_roots transient.

see #20103.


git-svn-id: http://svn.automattic.com/wordpress/trunk@20020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:05:00 +00:00
nacin 7df034983a Clarify second argument for get_raw_theme_root() as the multiple negatives can get confusing. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 19:59:53 +00:00
nacin d131a8951a Fix the return value of get_theme_root() when the theme root is outside of WP_CONTENT_DIR, thus making it absolute rather than the typical relative theme root.
Make get_theme_root_uri() tolerate an absolute path for a theme root. It will now make an attempt to find a corresponding URL for absolute paths as well.

see #17597.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 18:02:21 +00:00
nacin 53022ddbfb Revert [20001]. Theme roots that are passed around, stored, and cached can be valid as absolute paths or paths relative to wp-content. We'll have to patch this elsewhere. see #17597.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 16:22:26 +00:00
nacin e4bfd6ecc1 Move the template loading functions from wp-includes/theme.php to wp-includes/template.php. This includes get_query_template(), locate_template(), and friends. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 01:49:49 +00:00
nacin 08e57bfca5 Always return an absolute path in get_raw_theme_root() and get_theme_roots().
These functions were changed in [15641] to avoid any calculations when only one theme directory is registered. However, the short-circuit ended up being relative to WP_CONTENT_DIR, rather than absolute. This broke situations where theme roots are outside the content directory (technically allowed), and made return values inconsistent, as when multiple roots were registered, absolute paths were always returned.

fixes #17597. see #20103. see #14911.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 01:28:56 +00:00
koopersmith c832f904ae Introduce new theme customizer to replace theme preview. Rough first pass. props koopersmith, ocean90. see #19910.
Merges in http://plugins.svn.wordpress.org/gandalf/branches/dev/ rev 510148.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-25 04:12:43 +00:00
nacin 206bd59baa Twenty Twelve always trumps its pretenders. see #19978.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-21 17:39:05 +00:00
nacin 0acbde2f56 Return an empty object properly. see #17242.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-03 13:38:03 +00:00
ryan c43ddd7284 Allow flexible sizes for custom header uploads. Round 1. Props aaroncampbell, sabreuse. see #17242
git-svn-id: http://svn.automattic.com/wordpress/trunk@19815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-02 23:35:37 +00:00
ryan 83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +00:00
ryan f809fda4e7 Allow pluggable arg checking in current_theme_supports. Props dd32. fixes #11611
git-svn-id: http://svn.automattic.com/wordpress/trunk@19682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 18:29:40 +00:00
ryan d1ba11c7d1 Update some @since. Props dgwyer. fixes #19638
git-svn-id: http://svn.automattic.com/wordpress/trunk@19673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 19:03:33 +00:00
nacin 3f890507d4 Hide the toolbar on all subsequent links in the theme preview. props linuxologos, fixes #19610.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-20 22:10:47 +00:00
ryan 07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
nacin e78ef2fc43 Check is_array() against get_themes() in get_theme(). props cgrymala, see #19244.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-14 23:56:18 +00:00
ryan 6bbc8d4ce4 Avoid notice when themes dir is empty or missing. Don't reset current theme in current_theme_info() if there are no themes. Show warning in Right Now if there are no themes. Props azaozz. fixes #19089
git-svn-id: http://svn.automattic.com/wordpress/trunk@19251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-11 14:10:54 +00:00
nacin 89c0895887 new does not require by reference.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-18 20:20:59 +00:00
markjaquith 37aae9f46f Give custom background CSS more specificity. props GaryJ. fixes #18698
git-svn-id: http://svn.automattic.com/wordpress/trunk@18886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-05 17:20:43 +00:00