[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Theme Administration API

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

Defines 13 functions

  delete_theme()
  get_page_templates()
  _get_template_edit_filename()
  theme_update_available()
  get_theme_update_available()
  get_theme_feature_list()
  themes_api()
  wp_prepare_themes_for_js()
  customize_themes_print_templates()
  is_theme_paused()
  wp_get_theme_error()
  resume_theme()
  paused_themes_notice()

Functions
Functions that are not part of a class:

delete_theme( $stylesheet, $redirect = '' )   X-Ref
Removes a theme.

return: bool|null|WP_Error True on success, false if `$stylesheet` is empty, WP_Error on failure.
param: string $stylesheet Stylesheet of the theme to delete.
param: string $redirect   Redirect to page when complete.
since: 2.8.0

get_page_templates( $post = null, $post_type = 'page' )   X-Ref
Gets the page templates available in this theme.

return: string[] Array of template file names keyed by the template header name.
param: WP_Post|null $post      Optional. The post being edited, provided for context.
param: string       $post_type Optional. Post type to get the templates for. Default 'page'.
since: 1.5.0
since: 4.7.0 Added the `$post_type` parameter.

_get_template_edit_filename( $fullpath, $containingfolder )   X-Ref
Tidies a filename for url display by the theme file editor.

return: string
param: string $fullpath Full path to the theme file
param: string $containingfolder Path of the theme parent folder
since: 2.9.0

theme_update_available( $theme )   X-Ref
Check if there is an update for a theme available.

Will display link, if there is an update available.

param: WP_Theme $theme Theme data object.
since: 2.7.0

get_theme_update_available( $theme )   X-Ref
Retrieves the update link if there is a theme update available.

Will return a link if there is an update available.

return: string|false HTML for the update link, or false if invalid info was passed.
param: WP_Theme $theme WP_Theme object.
since: 3.8.0

get_theme_feature_list( $api = true )   X-Ref
Retrieves list of WordPress theme features (aka theme tags).

return: array Array of features keyed by category with translations keyed by slug.
param: bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true.
since: 3.1.0
since: 3.2.0 Added 'Gray' color and 'Featured Image Header', 'Featured Images',
since: 3.5.0 Added 'Flexible Header' feature.
since: 3.8.0 Renamed 'Width' filter to 'Layout'.
since: 3.8.0 Renamed 'Fixed Width' and 'Flexible Width' options
since: 3.8.0 Added 'Accessibility Ready' feature and 'Responsive Layout' option.
since: 3.9.0 Combined 'Layout' and 'Columns' filters.
since: 4.6.0 Removed 'Colors' filter.
since: 4.6.0 Added 'Grid Layout' option.
since: 4.6.0 Added 'Custom Logo' and 'Footer Widgets' features.
since: 4.6.0 Added 'Blog', 'E-Commerce', 'Education', 'Entertainment', 'Food & Drink',
since: 4.9.0 Reordered the filters from 'Layout', 'Features', 'Subject'
since: 4.9.0 Removed 'BuddyPress', 'Custom Menu', 'Flexible Header',
since: 5.5.0 Added 'Block Editor Patterns', 'Block Editor Styles',
since: 5.5.0 Added 'Wide Blocks' layout option.
since: 5.8.1 Added 'Template Editing' feature.

themes_api( $action, $args = array()   X-Ref
Retrieves theme installer pages from the WordPress.org Themes API.

It is possible for a theme to override the Themes API result with three
filters. Assume this is for themes, which can extend on the Theme Info to
offer more choices. This is very powerful and must be used with care, when
overriding the filters.

The first filter, {@see 'themes_api_args'}, is for the args and gives the action
as the second parameter. The hook for {@see 'themes_api_args'} must ensure that
an object is returned.

The second filter, {@see 'themes_api'}, allows a plugin to override the WordPress.org
Theme API entirely. If `$action` is 'query_themes', 'theme_information', or 'feature_list',
an object MUST be passed. If `$action` is 'hot_tags', an array should be passed.

Finally, the third filter, {@see 'themes_api_result'}, makes it possible to filter the
response object or array, depending on the `$action` type.

Supported arguments per action:

| Argument Name      | 'query_themes' | 'theme_information' | 'hot_tags' | 'feature_list'   |
| -------------------| :------------: | :-----------------: | :--------: | :--------------: |
| `$slug`            | No             |  Yes                | No         | No               |
| `$per_page`        | Yes            |  No                 | No         | No               |
| `$page`            | Yes            |  No                 | No         | No               |
| `$number`          | No             |  No                 | Yes        | No               |
| `$search`          | Yes            |  No                 | No         | No               |
| `$tag`             | Yes            |  No                 | No         | No               |
| `$author`          | Yes            |  No                 | No         | No               |
| `$user`            | Yes            |  No                 | No         | No               |
| `$browse`          | Yes            |  No                 | No         | No               |
| `$locale`          | Yes            |  Yes                | No         | No               |
| `$fields`          | Yes            |  Yes                | No         | No               |

return: object|array|WP_Error Response object or array on success, WP_Error on failure. See the
param: string       $action API action to perform: 'query_themes', 'theme_information',
param: array|object $args   {
since: 2.8.0

wp_prepare_themes_for_js( $themes = null )   X-Ref
Prepares themes for JavaScript.

return: array An associative array of theme data, sorted by name.
param: WP_Theme[] $themes Optional. Array of theme objects to prepare.
since: 3.8.0

customize_themes_print_templates()   X-Ref
Prints JS templates for the theme-browsing UI in the Customizer.

since: 4.2.0

is_theme_paused( $theme )   X-Ref
Determines whether a theme is technically active but was paused while
loading.

For more information on this and similar theme functions, check out
the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
Conditional Tags} article in the Theme Developer Handbook.

return: bool True, if in the list of paused themes. False, not in the list.
param: string $theme Path to the theme directory relative to the themes directory.
since: 5.2.0

wp_get_theme_error( $theme )   X-Ref
Gets the error that was recorded for a paused theme.

return: array|false Array of error information as it was returned by
param: string $theme Path to the theme directory relative to the themes
since: 5.2.0

resume_theme( $theme, $redirect = '' )   X-Ref
Tries to resume a single theme.

If a redirect was provided and a functions.php file was found, we first ensure that
functions.php file does not throw fatal errors anymore.

The way it works is by setting the redirection to the error before trying to
include the file. If the theme fails, then the redirection will not be overwritten
with the success message and the theme will not be resumed.

return: bool|WP_Error True on success, false if `$theme` was not paused,
param: string $theme    Single theme to resume.
param: string $redirect Optional. URL to redirect to. Default empty string.
since: 5.2.0

paused_themes_notice()   X-Ref
Renders an admin notice in case some themes have been paused due to errors.

since: 5.2.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1