[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

WordPress Theme Administration API

File Size: 1256 lines (48 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 2 files
 wp-admin/admin-header.php
 wp-admin/admin-footer.php

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.

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

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

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'.
return: string[] Array of template file names keyed by the template header name.

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

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

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.

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.

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

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

param: bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true.
return: array Array of features keyed by category with translations keyed by slug.

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               |

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

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

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

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


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.

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

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

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

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.

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

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




Generated : Wed Dec 25 08:20:01 2024 Cross-referenced by PHPXref