[ Index ]

WordPress Cross Reference

title

Body

[close]

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

Theme, template, and stylesheet functions.

File Size: 1894 lines (58 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 3 files
 wp-includes/class-wp-customize-manager.php
 wp-admin/custom-background.php
 wp-admin/custom-header.php

Defines 63 functions

  wp_get_themes()
  wp_get_theme()
  wp_clean_themes_cache()
  is_child_theme()
  get_stylesheet()
  get_stylesheet_directory()
  get_stylesheet_directory_uri()
  get_stylesheet_uri()
  get_locale_stylesheet_uri()
  get_template()
  get_template_directory()
  get_template_directory_uri()
  get_theme_roots()
  register_theme_directory()
  search_theme_directories()
  get_theme_root()
  get_theme_root_uri()
  get_raw_theme_root()
  locale_stylesheet()
  preview_theme()
  _preview_theme_template_filter()
  _preview_theme_stylesheet_filter()
  preview_theme_ob_filter()
  preview_theme_ob_filter_callback()
  switch_theme()
  validate_current_theme()
  get_theme_mods()
  get_theme_mod()
  set_theme_mod()
  remove_theme_mod()
  remove_theme_mods()
  get_header_textcolor()
  header_textcolor()
  display_header_text()
  get_header_image()
  _get_random_header_data()
  get_random_header_image()
  is_random_header_image()
  header_image()
  get_uploaded_header_images()
  get_custom_header()
  register_default_headers()
  unregister_default_headers()
  get_background_image()
  background_image()
  get_background_color()
  background_color()
  _custom_background_cb()
  add_editor_style()
  remove_editor_styles()
  add_theme_support()
  _custom_header_background_just_in_time()
  get_theme_support()
  remove_theme_support()
  _remove_theme_support()
  current_theme_supports()
  require_if_theme_supports()
  _delete_attachment_theme_mod()
  check_theme_switched()
  _wp_customize_include()
  _wp_customize_loader_settings()
  wp_customize_url()
  wp_customize_support_script()

Functions
Functions that are not part of a class:

wp_get_themes( $args = array()   X-Ref
Returns an array of WP_Theme objects based on the arguments.

Despite advances over get_themes(), this function is quite expensive, and grows
linearly with additional themes. Stick to wp_get_theme() if possible.

param: array $args The search arguments. Optional.
return: Array of WP_Theme objects.

wp_get_theme( $stylesheet = null, $theme_root = null )   X-Ref
Gets a WP_Theme object for a theme.

param: string $stylesheet Directory name for the theme. Optional. Defaults to current theme.
param: string $theme_root Absolute path of the theme root to look in. Optional. If not specified, get_raw_theme_root()
return: WP_Theme Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence.

wp_clean_themes_cache( $clear_update_cache = true )   X-Ref
Clears the cache held by get_theme_roots() and WP_Theme.

param: bool $clear_update_cache Whether to clear the Theme updates cache

is_child_theme()   X-Ref
Whether a child theme is in use.

return: bool true if a child theme is in use, false otherwise.

get_stylesheet()   X-Ref
Retrieve name of the current stylesheet.

The theme name that the administrator has currently set the front end theme
as.

For all extensive purposes, the template name and the stylesheet name are
going to be the same for most cases.

return: string Stylesheet name.

get_stylesheet_directory()   X-Ref
Retrieve stylesheet directory path for current theme.

return: string Path to current theme directory.

get_stylesheet_directory_uri()   X-Ref
Retrieve stylesheet directory URI.

return: string

get_stylesheet_uri()   X-Ref
Retrieve URI of current theme stylesheet.

The stylesheet file name is 'style.css' which is appended to {@link
get_stylesheet_directory_uri() stylesheet directory URI} path.

return: string

get_locale_stylesheet_uri()   X-Ref
Retrieve localized stylesheet URI.

The stylesheet directory for the localized stylesheet files are located, by
default, in the base theme directory. The name of the locale file will be the
locale followed by '.css'. If that does not exist, then the text direction
stylesheet will be checked for existence, for example 'ltr.css'.

The theme may change the location of the stylesheet directory by either using
the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
If you want to change the location of the stylesheet files for the entire
WordPress workflow, then change the former. If you just have the locale in a
separate folder, then change the latter.

return: string

get_template()   X-Ref
Retrieve name of the current theme.

return: string Template name.

get_template_directory()   X-Ref
Retrieve current theme directory.

return: string Template directory path.

get_template_directory_uri()   X-Ref
Retrieve theme directory URI.

return: string Template directory URI.

get_theme_roots()   X-Ref
Retrieve theme roots.

return: array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.

register_theme_directory( $directory )   X-Ref
Register a directory that contains themes.

param: string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
return: bool

search_theme_directories( $force = false )   X-Ref
Search all registered theme directories for complete and valid themes.

param: bool $force Optional. Whether to force a new directory scan. Defaults to false.
return: array Valid themes found

get_theme_root( $stylesheet_or_template = false )   X-Ref
No description

get_theme_root_uri( $stylesheet_or_template = false, $theme_root = false )   X-Ref
Retrieve URI for themes directory.

Does not have trailing slash.

param: string $stylesheet_or_template Optional. The stylesheet or template name of the theme.
param: string $theme_root Optional. The theme root for which calculations will be based, preventing
return: string Themes URI.

get_raw_theme_root( $stylesheet_or_template, $skip_cache = false )   X-Ref
Get the raw theme root relative to the content directory with no filters applied.

param: string $stylesheet_or_template The stylesheet or template name of the theme
param: bool $skip_cache Optional. Whether to skip the cache. Defaults to false, meaning the cache is used.
return: string Theme root

locale_stylesheet()   X-Ref
Display localized stylesheet link element.


preview_theme()   X-Ref
Start preview theme output buffer.

Will only perform task if the user has permissions and template and preview
query variables exist.


_preview_theme_template_filter()   X-Ref
Private function to modify the current template when previewing a theme

return: string

_preview_theme_stylesheet_filter()   X-Ref
Private function to modify the current stylesheet when previewing a theme

return: string

preview_theme_ob_filter( $content )   X-Ref
Callback function for ob_start() to capture all links in the theme.

param: string $content
return: string

preview_theme_ob_filter_callback( $matches )   X-Ref
Manipulates preview theme links in order to control and maintain location.

Callback function for preg_replace_callback() to accept and filter matches.

param: array $matches
return: string

switch_theme( $stylesheet )   X-Ref
Switches the theme.

Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature
of two arguments: $template then $stylesheet. This is for backwards compatibility.

param: string $stylesheet Stylesheet name

validate_current_theme()   X-Ref
Checks that current theme files 'index.php' and 'style.css' exists.

Does not check the default theme, which is the fallback and should always exist.
Will switch theme to the fallback theme if current theme does not validate.
You can use the 'validate_current_theme' filter to return false to
disable this functionality.

return: bool

get_theme_mods()   X-Ref
Retrieve all theme modifications.

return: array Theme modifications.

get_theme_mod( $name, $default = false )   X-Ref
Retrieve theme modification value for the current theme.

If the modification name does not exist, then the $default will be passed
through {@link http://php.net/sprintf sprintf()} PHP function with the first
string the template directory URI and the second string the stylesheet
directory URI.

param: string $name Theme modification name.
param: bool|string $default
return: string

set_theme_mod( $name, $value )   X-Ref
Update theme modification value for the current theme.

param: string $name Theme modification name.
param: string $value theme modification value.

remove_theme_mod( $name )   X-Ref
Remove theme modification name from current theme list.

If removing the name also removes all elements, then the entire option will
be removed.

param: string $name Theme modification name.
return: null

remove_theme_mods()   X-Ref
Remove theme modifications option for current theme.


get_header_textcolor()   X-Ref
Retrieve text color for custom header.

return: string

header_textcolor()   X-Ref
Display text color for custom header.


display_header_text()   X-Ref
Whether to display the header text.

return: bool

get_header_image()   X-Ref
Retrieve header image for custom header.

return: string

_get_random_header_data()   X-Ref
Get random header image data from registered images in theme.

return: string Path to header image

get_random_header_image()   X-Ref
Get random header image url from registered images in theme.

return: string Path to header image

is_random_header_image( $type = 'any' )   X-Ref
Check if random header image is in use.

Always true if user expressly chooses the option in Appearance > Header.
Also true if theme has multiple header images registered, no specific header image
is chosen, and theme turns on random headers with add_theme_support().

param: string $type The random pool to use. any|default|uploaded
return: boolean

header_image()   X-Ref
Display header image URL.


get_uploaded_header_images()   X-Ref
Get the header images uploaded for the current theme.

return: array

get_custom_header()   X-Ref
Get the header image data.

return: object

register_default_headers( $headers )   X-Ref
Register a selection of default headers to be displayed by the custom header admin UI.

param: array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.

unregister_default_headers( $header )   X-Ref
Unregister default headers.

This function must be called after register_default_headers() has already added the
header you want to remove.

param: string|array $header The header string id (key of array) to remove, or an array thereof.
return: True on success, false on failure.

get_background_image()   X-Ref
Retrieve background image for custom background.

return: string

background_image()   X-Ref
Display background image path.


get_background_color()   X-Ref
Retrieve value for custom background color.

return: string

background_color()   X-Ref
Display background color value.


_custom_background_cb()   X-Ref
Default custom background callback.


add_editor_style( $stylesheet = 'editor-style.css' )   X-Ref
Add callback for custom TinyMCE editor stylesheets.

The parameter $stylesheet is the name of the stylesheet, relative to
the theme root. It also accepts an array of stylesheets.
It is optional and defaults to 'editor-style.css'.

This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.
If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE.
If an array of stylesheets is passed to add_editor_style(),
RTL is only added for the first stylesheet.

Since version 3.4 the TinyMCE body has .rtl CSS class.
It is a better option to use that class and add any RTL styles to the main stylesheet.

param: mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.

remove_editor_styles()   X-Ref
Removes all visual editor stylesheets.

return: bool True on success, false if there were no stylesheets to remove.

add_theme_support( $feature )   X-Ref
Allows a theme to register its support of a certain feature

Must be called in the theme's functions.php file to work.
If attached to a hook, it must be after_setup_theme.
The init hook may be too late for some features.

param: string $feature the feature being added

_custom_header_background_just_in_time()   X-Ref
Registers the internal custom header and background routines.


get_theme_support( $feature )   X-Ref
Gets the theme support arguments passed when registering that support

param: string $feature the feature to check
return: array The array of extra arguments

remove_theme_support( $feature )   X-Ref
Allows a theme to de-register its support of a certain feature

Should be called in the theme's functions.php file. Generally would
be used for child themes to override support from the parent theme.

param: string $feature the feature being added
return: bool Whether feature was removed.

_remove_theme_support( $feature )   X-Ref
Do not use. Removes theme support internally, ignorant of the blacklist.


current_theme_supports( $feature )   X-Ref
Checks a theme's support for a given feature

param: string $feature the feature being checked
return: boolean

require_if_theme_supports( $feature, $include)   X-Ref
Checks a theme's support for a given feature before loading the functions which implement it.

param: string $feature the feature being checked
param: string $include the file containing the functions that implement the feature

_delete_attachment_theme_mod( $id )   X-Ref
Checks an attachment being deleted to see if it's a header or background image.

If true it removes the theme modification which would be pointing at the deleted
attachment

param: int $id the attachment id

check_theme_switched()   X-Ref
Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load


_wp_customize_include()   X-Ref
Includes and instantiates the WP_Customize_Manager class.

Fires when ?wp_customize=on or on wp-admin/customize.php.


_wp_customize_loader_settings()   X-Ref
Adds settings for the customize-loader script.


wp_customize_url( $stylesheet = null )   X-Ref
Returns a URL to load the theme customizer.

param: string $stylesheet Optional. Theme to customize. Defaults to current theme.

wp_customize_support_script()   X-Ref
Prints a script to check whether or not the customizer is supported,
and apply either the no-customize-support or customize-support class
to the body.

This function MUST be called inside the body tag.

Ideally, call this function immediately after the body tag is opened.
This prevents a flash of unstyled content.

It is also recommended that you add the "no-customize-support" class
to the body tag by default.




Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu