2015-10-24 20:21:25 +02:00
< ? php
/**
* Customize API : WP_Customize_Themes_Section class
*
* @ package WordPress
* @ subpackage Customize
* @ since 4.4 . 0
*/
/**
* Customize Themes Section class .
*
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
* A UI container for theme controls , which are displayed within sections .
2015-10-24 20:21:25 +02:00
*
* @ since 4.2 . 0
*
* @ see WP_Customize_Section
*/
class WP_Customize_Themes_Section extends WP_Customize_Section {
/**
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
* Section type .
2015-10-24 20:21:25 +02:00
*
* @ since 4.2 . 0
* @ var string
*/
public $type = 'themes' ;
/**
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
* Theme section action .
2015-10-24 20:21:25 +02:00
*
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
* Defines the type of themes to load ( installed , wporg , etc . ) .
*
* @ since 4.9 . 0
* @ var string
2015-10-24 20:21:25 +02:00
*/
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
public $action = '' ;
2016-11-04 18:18:26 +01:00
2017-10-10 09:09:52 +02:00
/**
* Theme section filter type .
*
* Determines whether filters are applied to loaded ( local ) themes or by initiating a new remote query ( remote ) .
* When filtering is local , the initial themes query is not paginated by default .
*
* @ since 4.9 . 0
* @ var string
*/
public $filter_type = 'local' ;
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
/**
* Get section parameters for JS .
*
* @ since 4.9 . 0
* @ return array Exported parameters .
*/
public function json () {
2017-12-01 00:11:00 +01:00
$exported = parent :: json ();
$exported [ 'action' ] = $this -> action ;
2017-10-10 09:09:52 +02:00
$exported [ 'filter_type' ] = $this -> filter_type ;
2016-11-04 18:18:26 +01:00
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
return $exported ;
}
2016-11-04 18:18:26 +01:00
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
/**
* Render a themes section as a JS template .
*
* The template is only rendered by PHP once , so all actions are prepared at once on the server side .
*
* @ since 4.9 . 0
*/
protected function render_template () {
?>
< li id = " accordion-section- { { data.id }} " class = " theme-section " >
< button type = " button " class = " customize-themes-section-title themes-section- { { data.id }} " > {{ data . title }} </ button >
< ? php if ( current_user_can ( 'install_themes' ) || is_multisite () ) : // @todo: upload support ?>
< ? php endif ; ?>
< div class = " customize-themes-section themes-section- { { data.id }} control-section-content themes-php " >
< div class = " theme-overlay " tabindex = " 0 " role = " dialog " aria - label = " <?php esc_attr_e( 'Theme Details' ); ?> " ></ div >
2015-10-24 20:21:25 +02:00
< div class = " theme-browser rendered " >
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
< div class = " customize-preview-header themes-filter-bar " >
< ? php $this -> filter_bar_content_template (); ?>
</ div >
2017-10-23 20:58:46 +02:00
< ? php $this -> filter_drawer_content_template (); ?>
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
< div class = " error unexpected-error " style = " display: none; " >< p >< ? php _e ( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ); ?> </p></div>
< ul class = " themes " >
2015-10-24 20:21:25 +02:00
</ ul >
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
< p class = " no-themes " >< ? php _e ( 'No themes found. Try a different search.' ); ?> </p>
< p class = " no-themes-local " >
< ? php
2017-12-01 00:11:00 +01:00
printf (
2018-08-30 14:36:24 +02:00
/* translators: %s: "Search WordPress.org themes" button text */
2017-12-01 00:11:00 +01:00
__ ( 'No themes found. Try a different search, or %s.' ),
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
sprintf ( '<button type="button" class="button-link search-dotorg-themes">%s</button>' , __ ( 'Search WordPress.org themes' ) )
);
?>
</ p >
< p class = " spinner " ></ p >
2015-10-24 20:21:25 +02:00
</ div >
</ div >
</ li >
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
< ? php
}
/**
* Render the filter bar portion of a themes section as a JS template .
*
* The template is only rendered by PHP once , so all actions are prepared at once on the server side .
* The filter bar container is rendered by @ see `render_template()` .
*
* @ since 4.9 . 0
*/
protected function filter_bar_content_template () {
?>
< button type = " button " class = " button button-primary customize-section-back customize-themes-mobile-back " >< ? php _e ( 'Back to theme sources' ); ?> </button>
< # if ( 'wporg' === data.action ) { #>
< div class = " search-form " >
2017-10-03 17:44:46 +02:00
< label for = " wp-filter-search-input- { { data.id }} " class = " screen-reader-text " >< ? php _e ( 'Search themes…' ); ?> </label>
< input type = " search " id = " wp-filter-search-input- { { data.id }} " placeholder = " <?php esc_attr_e( 'Search themes…' ); ?> " aria - describedby = " { { data.id }}-live-search-desc " class = " wp-filter-search " >
2017-10-18 06:06:47 +02:00
< div class = " search-icon " aria - hidden = " true " ></ div >
2017-10-03 17:44:46 +02:00
< span id = " { { data.id }}-live-search-desc " class = " screen-reader-text " >< ? php _e ( 'The search results will be updated as you type.' ); ?> </span>
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
</ div >
< button type = " button " class = " button feature-filter-toggle " >
< span class = " filter-count-0 " >< ? php _e ( 'Filter themes' ); ?> </span><span class="filter-count-filters">
< ? php
/* translators: %s: number of filters selected. */
printf ( __ ( 'Filter themes (%s)' ), '<span class="theme-filter-count">0</span>' );
?>
</ span >
</ button >
< # } else { #>
2017-10-03 17:44:46 +02:00
< div class = " themes-filter-container " >
< label for = " { { data.id }}-themes-filter " class = " screen-reader-text " >< ? php _e ( 'Search themes…' ); ?> </label>
< input type = " search " id = " { { data.id }}-themes-filter " placeholder = " <?php esc_attr_e( 'Search themes…' ); ?> " aria - describedby = " { { data.id }}-live-search-desc " class = " wp-filter-search wp-filter-search-themes " />
2017-10-18 06:06:47 +02:00
< div class = " search-icon " aria - hidden = " true " ></ div >
2017-10-03 17:44:46 +02:00
< span id = " { { data.id }}-live-search-desc " class = " screen-reader-text " >< ? php _e ( 'The search results will be updated as you type.' ); ?> </span>
</ div >
Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.
Also includes CSS auto-prefixing added via `grunt precommit:css`.
For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/
Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.
Built from https://develop.svn.wordpress.org/trunk@41648
git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 22:13:50 +02:00
< # } #>
< div class = " filter-themes-count " >
< span class = " themes-displayed " >
< ? php
/* translators: %s: number of themes displayed. */
echo sprintf ( __ ( '%s themes' ), '<span class="theme-count">0</span>' );
?>
</ span >
</ div >
< ? php
}
2017-10-18 17:11:46 +02:00
/**
* Render the filter drawer portion of a themes section as a JS template .
*
* The filter bar container is rendered by @ see `render_template()` .
*
* @ since 4.9 . 0
*/
protected function filter_drawer_content_template () {
$feature_list = get_theme_feature_list ( false ); // @todo: Use the .org API instead of the local core feature list. The .org API is currently outdated and will be reconciled when the .org themes directory is next redesigned.
?>
2017-10-23 20:58:46 +02:00
< # if ( 'wporg' === data.action ) { #>
< div class = " filter-drawer filter-details " >
< ? php foreach ( $feature_list as $feature_name => $features ) : ?>
< fieldset class = " filter-group " >
< legend >< ? php echo esc_html ( $feature_name ); ?> </legend>
< div class = " filter-group-feature " >
< ? php foreach ( $features as $feature => $feature_name ) : ?>
< input type = " checkbox " id = " filter-id-<?php echo esc_attr( $feature ); ?> " value = " <?php echo esc_attr( $feature ); ?> " />
2018-01-15 20:27:53 +01:00
< label for = " filter-id-<?php echo esc_attr( $feature ); ?> " >< ? php echo esc_html ( $feature_name ); ?> </label>
2017-10-23 20:58:46 +02:00
< ? php endforeach ; ?>
</ div >
</ fieldset >
< ? php endforeach ; ?>
</ div >
< # } #>
2017-10-18 17:11:46 +02:00
< ? php
}
2015-10-24 20:21:25 +02:00
}