[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> theme-previews.php (summary)

Theme previews using the Site Editor for block themes.

File Size: 93 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  wp_get_theme_preview_path()
  wp_attach_theme_preview_middleware()
  wp_block_theme_activate_nonce()
  wp_initialize_theme_preview_hooks()

Functions
Functions that are not part of a class:

wp_get_theme_preview_path( $current_stylesheet = null )   X-Ref
Filters the blog option to return the path for the previewed theme.

return: string The previewed theme's stylesheet or template path.
param: string $current_stylesheet The current theme's stylesheet or template path.

wp_attach_theme_preview_middleware()   X-Ref
Adds a middleware to `apiFetch` to set the theme for the preview.
This adds a `wp_theme_preview` URL parameter to API requests from the Site Editor, so they also respond as if the theme is set to the value of the parameter.


wp_block_theme_activate_nonce()   X-Ref
Set a JavaScript constant for theme activation.

Sets the JavaScript global WP_BLOCK_THEME_ACTIVATE_NONCE containing the nonce
required to activate a theme. For use within the site editor.


wp_initialize_theme_preview_hooks()   X-Ref
Add filters and actions to enable Block Theme Previews in the Site Editor.

The filters and actions should be added after `pluggable.php` is included as they may
trigger code that uses `current_user_can()` which requires functionality from `pluggable.php`.




Generated : Sat Apr 27 08:20:02 2024 Cross-referenced by PHPXref