Commit Graph

304 Commits

Author SHA1 Message Date
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