[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

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

Theme, template, and stylesheet functions.

File Size: 1385 lines (40 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/custom-header.php

Defines 54 functions

  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_data()
  get_themes()
  get_theme_roots()
  get_theme()
  get_current_theme()
  register_theme_directory()
  search_theme_directories()
  get_theme_root()
  get_theme_root_uri()
  get_query_template()
  get_404_template()
  get_archive_template()
  get_author_template()
  get_category_template()
  get_tag_template()
  get_taxonomy_template()
  get_date_template()
  get_home_template()
  get_page_template()
  get_paged_template()
  get_search_template()
  get_single_template()
  get_attachment_template()
  get_comments_popup_template()
  locate_template()
  load_template()
  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_mod()
  set_theme_mod()
  remove_theme_mod()
  remove_theme_mods()
  get_header_textcolor()
  header_textcolor()
  get_header_image()
  header_image()
  add_custom_image_header()
  add_theme_support()
  current_theme_supports()
  require_if_theme_supports()

Functions
Functions that are not part of a class:

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_data( $theme_file )   X-Ref
Retrieve theme data from parsed theme file.

The description will have the tags filtered with the following HTML elements
whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
<b>acronym<b> element with the <em>title</em> attribute allowed. The
<b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.

The style.css file must contain theme name, theme URI, and description. The
data can also contain author URI, author, template (parent template),
version, status, and finally tags. Some of these are not used by WordPress
administration panels, but are used by theme directory web sites which list
the theme.

param: string $theme_file Theme file path.
return: array Theme data.

get_themes()   X-Ref
Retrieve list of themes with theme data in theme directory.

The theme is broken, if it doesn't have a parent theme and is missing either
style.css and, or index.php. If the theme has a parent theme then it is
broken, if it is missing style.css; index.php is optional. The broken theme
list is saved in the {@link $wp_broken_themes} global, which is displayed on
the theme list in the administration panels.

return: array Theme list with theme data.

get_theme_roots()   X-Ref
Retrieve theme roots.

return: array Theme roots

get_theme($theme)   X-Ref
Retrieve theme data.

param: string $theme Theme name.
return: array|null Null, if theme name does not exist. Theme data, if exists.

get_current_theme()   X-Ref
Retrieve current theme display name.

If the 'current_theme' option has already been set, then it will be returned
instead. If it is not set, then each theme will be iterated over until both
the current stylesheet and current template name.

return: string

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()   X-Ref
Search all registered theme directories for complete and valid themes.

return: array Valid themes found

get_theme_root( $stylesheet_or_template = false )   X-Ref
Retrieve path to themes directory.

Does not have trailing slash.

param: $stylesheet_or_template The stylesheet or template name of the theme
return: string Theme path.

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

Does not have trailing slash.

param: $stylesheet_or_template The stylesheet or template name of the theme
return: string Themes URI.

get_query_template($type)   X-Ref
Retrieve path to file without the use of extension.

Used to quickly retrieve the path of file without including the file
extension. It will also check the parent template, if the file exists, with
the use of {@link locate_template()}. Allows for more generic file location
without the use of the other get_*_template() functions.

Can be used with include() or require() to retrieve path.
<code>
if( '' != get_query_template( '404' ) )
include( get_query_template( '404' ) );
</code>
or the same can be accomplished with
<code>
if( '' != get_404_template() )
include( get_404_template() );
</code>

param: string $type Filename without extension.
return: string Full path to file.

get_404_template()   X-Ref
Retrieve path of 404 template in current or parent template.

return: string

get_archive_template()   X-Ref
Retrieve path of archive template in current or parent template.

return: string

get_author_template()   X-Ref
Retrieve path of author template in current or parent template.

return: string

get_category_template()   X-Ref
Retrieve path of category template in current or parent template.

Works by first retrieving the current slug for example 'category-default.php' and then
trying category ID, for example 'category-1.php' and will finally fallback to category.php
template, if those files don't exist.

return: string

get_tag_template()   X-Ref
Retrieve path of tag template in current or parent template.

Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then
trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php
template, if those files don't exist.

return: string

get_taxonomy_template()   X-Ref
Retrieve path of taxonomy template in current or parent template.

Retrieves the taxonomy and term, if term is available. The template is
prepended with 'taxonomy-' and followed by both the taxonomy string and
the taxonomy string followed by a dash and then followed by the term.

The taxonomy and term template is checked and used first, if it exists.
Second, just the taxonomy template is checked, and then finally, taxonomy.php
template is used. If none of the files exist, then it will fall back on to
index.php.

return: string

get_date_template()   X-Ref
Retrieve path of date template in current or parent template.

return: string

get_home_template()   X-Ref
Retrieve path of home template in current or parent template.

Attempts to locate 'home.php' first before falling back to 'index.php'.

return: string

get_page_template()   X-Ref
Retrieve path of page template in current or parent template.

Will first look for the specifically assigned page template
The will search for 'page-{slug}.php' followed by 'page-id.php'
and finally 'page.php'

return: string

get_paged_template()   X-Ref
Retrieve path of paged template in current or parent template.

return: string

get_search_template()   X-Ref
Retrieve path of search template in current or parent template.

return: string

get_single_template()   X-Ref
Retrieve path of single template in current or parent template.

return: string

get_attachment_template()   X-Ref
Retrieve path of attachment template in current or parent template.

The attachment path first checks if the first part of the mime type exists.
The second check is for the second part of the mime type. The last check is
for both types separated by an underscore. If neither are found then the file
'attachment.php' is checked and returned.

Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
finally 'text_plain.php'.

return: string

get_comments_popup_template()   X-Ref
Retrieve path of comment popup template in current or parent template.

Checks for comment popup template in current template, if it exists or in the
parent template. If it doesn't exist, then it retrieves the comment-popup.php
file from the default theme. The default theme must then exist for it to
work.

return: string

locate_template($template_names, $load = false)   X-Ref
Retrieve the name of the highest priority template file that exists.

Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
inherit from a parent theme can just overload one file.

param: array $template_names Array of template files to search for in priority order.
param: bool $load If true the template file will be loaded if it is found.
return: string The template filename if one is located.

load_template($_template_file)   X-Ref
Require once the template file with WordPress environment.

The globals are set up for the template file to ensure that the WordPress
environment is available from within the function. The query variables are
also available.

param: string $_template_file Path to template file.

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


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

Will only preform 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($template, $stylesheet)   X-Ref
Switches current theme to new template and stylesheet names.

param: string $template Template name
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. The 'default' theme should always exist
or should have another theme renamed to that template name and directory
path. Will switch theme to default 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_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.


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

return: string

header_image()   X-Ref
Display header image path.


add_custom_image_header($header_callback, $admin_header_callback)   X-Ref
Add callbacks for image header display.

The parameter $header_callback callback will be required to display the
content for the 'wp_head' action. The parameter $admin_header_callback
callback will be added to Custom_Image_Header class and that will be added
to the 'admin_menu' action.

param: callback $header_callback Call on 'wp_head' action.
param: callback $admin_header_callback Call on administration panels.

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

Must be called in the themes functions.php file to work.

author: Mark Jaquith
param: string $feature the feature being added

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

author: Mark Jaquith
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.

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



Generated: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7