[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Template WordPress Administration API. A Big Mess. Also some neat functions that are nicely written.

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

Defines 48 functions

  wp_category_checklist()
  wp_terms_checklist()
  wp_popular_terms_checklist()
  wp_link_category_checklist()
  get_inline_data()
  wp_comment_reply()
  wp_comment_trashnotice()
  list_meta()
  _list_meta_row()
  meta_form()
  touch_time()
  page_template_dropdown()
  parent_dropdown()
  wp_dropdown_roles()
  wp_import_upload_form()
  add_meta_box()
  do_block_editor_incompatible_meta_box()
  _get_plugin_from_callback()
  do_meta_boxes()
  remove_meta_box()
  do_accordion_sections()
  add_settings_section()
  add_settings_field()
  do_settings_sections()
  do_settings_fields()
  add_settings_error()
  get_settings_errors()
  settings_errors()
  find_posts_div()
  the_post_password()
  _draft_or_post_title()
  _admin_search_query()
  iframe_header()
  tb_close()
  iframe_footer()
  _post_states()
  get_post_states()
  _media_states()
  get_media_states()
  compression_test()
  submit_button()
  get_submit_button()
  _wp_admin_html_begin()
  convert_to_screen()
  _local_storage_notice()
  wp_star_rating()
  _wp_posts_page_notice()
  _wp_block_editor_posts_page_notice()

Functions
Functions that are not part of a class:

wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true )   X-Ref
Outputs an unordered list of checkbox input elements labeled with category names.

since: 2.5.1
param: int         $post_id              Optional. Post to generate a categories checklist for. Default 0.
param: int         $descendants_and_self Optional. ID of the category to output along with its descendants.
param: int[]|false $selected_cats        Optional. Array of category IDs to mark as checked. Default false.
param: int[]|false $popular_cats         Optional. Array of category IDs to receive the "popular-category" class.
param: Walker      $walker               Optional. Walker object to use to build the output.
param: bool        $checked_ontop        Optional. Whether to move checked items out of the hierarchy and to

wp_terms_checklist( $post_id = 0, $args = array()   X-Ref
Outputs an unordered list of checkbox input elements labelled with term names.

Taxonomy-independent version of wp_category_checklist().

since: 3.0.0
since: 4.4.0 Introduced the `$echo` argument.
return: string HTML list of input elements.
param: int          $post_id Optional. Post ID. Default 0.
param: array|string $args {

wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true )   X-Ref
Retrieves a list of the most popular terms from the specified taxonomy.

If the `$display` argument is true then the elements for a list of checkbox
`<input>` elements labelled with the names of the selected terms is output.
If the `$post_ID` global is not empty then the terms associated with that
post will be marked as checked.

since: 2.5.0
return: int[] Array of popular term IDs.
param: string $taxonomy     Taxonomy to retrieve terms from.
param: int    $default_term Optional. Not used.
param: int    $number       Optional. Number of terms to retrieve. Default 10.
param: bool   $display      Optional. Whether to display the list as well. Default true.

wp_link_category_checklist( $link_id = 0 )   X-Ref
Outputs a link category checklist element.

since: 2.5.1
param: int $link_id

get_inline_data( $post )   X-Ref
Adds hidden fields with the data for use in the inline editor for posts and pages.

since: 2.7.0
param: WP_Post $post Post object.

wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true )   X-Ref
Outputs the in-line comment reply-to form in the Comments list table.

since: 2.7.0
param: int    $position
param: bool   $checkbox
param: string $mode
param: bool   $table_row

wp_comment_trashnotice()   X-Ref
Outputs 'undo move to Trash' text for comments.

since: 2.9.0

list_meta( $meta )   X-Ref
Outputs a post's public meta data in the Custom Fields meta box.

since: 1.2.0
param: array $meta

_list_meta_row( $entry, &$count )   X-Ref
Outputs a single row of public meta data in the Custom Fields meta box.

since: 2.5.0
return: string
param: array $entry
param: int   $count

meta_form( $post = null )   X-Ref
Prints the form in the Custom Fields meta box.

since: 1.2.0
param: WP_Post $post Optional. The post being edited.

touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 )   X-Ref
Prints out HTML form date elements for editing post or comment publish date.

since: 0.71
since: 4.4.0 Converted to use get_comment() instead of the global `$comment`.
param: int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
param: int|bool $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
param: int      $tab_index The tabindex attribute to add. Default 0.
param: int|bool $multi     Optional. Whether the additional fields and buttons should be added.

page_template_dropdown( $default_template = '', $post_type = 'page' )   X-Ref
Prints out option HTML elements for the page templates drop-down.

since: 1.5.0
since: 4.7.0 Added the `$post_type` parameter.
param: string $default_template Optional. The template file name. Default empty.
param: string $post_type        Optional. Post type to get templates for. Default 'post'.

parent_dropdown( $default_page = 0, $parent_page = 0, $level = 0, $post = null )   X-Ref
Prints out option HTML elements for the page parents drop-down.

since: 1.5.0
since: 4.4.0 `$post` argument was added.
return: void|false Void on success, false if the page has no children.
param: int         $default_page Optional. The default page ID to be pre-selected. Default 0.
param: int         $parent_page  Optional. The parent page ID. Default 0.
param: int         $level        Optional. Page depth level. Default 0.
param: int|WP_Post $post         Post ID or WP_Post object.

wp_dropdown_roles( $selected = '' )   X-Ref
Prints out option HTML elements for role selectors.

since: 2.1.0
param: string $selected Slug for the role that should be already selected.

wp_import_upload_form( $action )   X-Ref
Outputs the form used by the importers to accept the data to be imported

since: 2.0.0
param: string $action The action attribute for the form.

add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null )   X-Ref
Adds a meta box to one or more screens.

since: 2.5.0
since: 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
param: string                 $id            Meta box ID (used in the 'id' attribute for the meta box).
param: string                 $title         Title of the meta box.
param: callable               $callback      Function that fills the box with the desired content.
param: string|array|WP_Screen $screen        Optional. The screen or screens on which to show the box
param: string                 $context       Optional. The context within the screen where the box
param: string                 $priority      Optional. The priority within the context where the box should show.
param: array                  $callback_args Optional. Data that should be set as the $args property

do_block_editor_incompatible_meta_box( $data_object, $box )   X-Ref
Renders a "fake" meta box with an information message,
shown on the block editor, when an incompatible meta box is found.

since: 5.0.0
param: mixed $data_object The data object being rendered on this screen.
param: array $box         {

_get_plugin_from_callback( $callback )   X-Ref
Internal helper function to find the plugin from a meta box callback.

since: 5.0.0
return: array|null The plugin that the callback belongs to, or null if it doesn't belong to a plugin.
param: callable $callback The callback function to check.

do_meta_boxes( $screen, $context, $data_object )   X-Ref
Meta-Box template function.

since: 2.5.0
return: int Number of meta_boxes.
param: string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
param: string           $context     The screen context for which to display meta boxes.
param: mixed            $data_object Gets passed to the meta box callback function as the first parameter.

remove_meta_box( $id, $screen, $context )   X-Ref
Removes a meta box from one or more screens.

since: 2.6.0
since: 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
param: string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
param: string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
param: string                 $context The context within the screen where the box is set to display.

do_accordion_sections( $screen, $context, $data_object )   X-Ref
Meta Box Accordion Template Function.

Largely made up of abstracted code from do_meta_boxes(), this
function serves to build meta boxes as list items for display as
a collapsible accordion.

since: 3.6.0
return: int Number of meta boxes as accordion sections.
param: string|object $screen      The screen identifier.
param: string        $context     The screen context for which to display accordion sections.
param: mixed         $data_object Gets passed to the section callback function as the first parameter.

add_settings_section( $id, $title, $callback, $page )   X-Ref
Adds a new section to a settings page.

Part of the Settings API. Use this to define new settings sections for an admin page.
Show settings sections in your admin page callback function with do_settings_sections().
Add settings fields to your section with add_settings_field().

The $callback argument should be the name of a function that echoes out any
content you want to show at the top of the settings section before the actual
fields. It can output nothing if you want.

since: 2.7.0
param: string   $id       Slug-name to identify the section. Used in the 'id' attribute of tags.
param: string   $title    Formatted title of the section. Shown as the heading for the section.
param: callable $callback Function that echos out any content at the top of the section (between heading and fields).
param: string   $page     The slug-name of the settings page on which to show the section. Built-in pages include

add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array()   X-Ref
Adds a new field to a section of a settings page.

Part of the Settings API. Use this to define a settings field that will show
as part of a settings section inside a settings page. The fields are shown using
do_settings_fields() in do_settings_sections().

The $callback argument should be the name of a function that echoes out the
HTML input tags for this setting field. Use get_option() to retrieve existing
values to show.

since: 2.7.0
since: 4.2.0 The `$class` argument was added.
param: string   $id       Slug-name to identify the field. Used in the 'id' attribute of tags.
param: string   $title    Formatted title of the field. Shown as the label for the field
param: callable $callback Function that fills the field with the desired form inputs. The
param: string   $page     The slug-name of the settings page on which to show the section
param: string   $section  Optional. The slug-name of the section of the settings page
param: array    $args {

do_settings_sections( $page )   X-Ref
Prints out all settings sections added to a particular settings page

Part of the Settings API. Use this in a settings page callback function
to output all the sections and fields that were added to that $page with
add_settings_section() and add_settings_field()

since: 2.7.0
param: string $page The slug name of the page whose settings sections you want to output.

do_settings_fields( $page, $section )   X-Ref
Prints out the settings fields for a particular settings section.

Part of the Settings API. Use this in a settings page to output
a specific section. Should normally be called by do_settings_sections()
rather than directly.

since: 2.7.0
param: string $page Slug title of the admin page whose settings fields you want to show.
param: string $section Slug title of the settings section whose fields you want to show.

add_settings_error( $setting, $code, $message, $type = 'error' )   X-Ref
Registers a settings error to be displayed to the user.

Part of the Settings API. Use this to show messages to users about settings validation
problems, missing settings or anything else.

Settings errors should be added inside the $sanitize_callback function defined in
register_setting() for a given setting to give feedback about the submission.

By default messages will show immediately after the submission that generated the error.
Additional calls to settings_errors() can be used to show errors even when the settings
page is first accessed.

since: 3.0.0
since: 5.3.0 Added `warning` and `info` as possible values for `$type`.
param: string $setting Slug title of the setting to which this error applies.
param: string $code    Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
param: string $message The formatted message text to display to the user (will be shown inside styled
param: string $type    Optional. Message type, controls HTML class. Possible values include 'error',

get_settings_errors( $setting = '', $sanitize = false )   X-Ref
Fetches settings errors registered by add_settings_error().

Checks the $wp_settings_errors array for any errors declared during the current
pageload and returns them.

If changes were just submitted ($_GET['settings-updated']) and settings errors were saved
to the 'settings_errors' transient then those errors will be returned instead. This
is used to pass errors back across pageloads.

Use the $sanitize argument to manually re-sanitize the option before returning errors.
This is useful if you have errors or notices you want to show even when the user
hasn't submitted data (i.e. when they first load an options page, or in the {@see 'admin_notices'}
action hook).

since: 3.0.0
return: array {
param: string $setting  Optional. Slug title of a specific setting whose errors you want.
param: bool   $sanitize Optional. Whether to re-sanitize the setting value before returning errors.

settings_errors( $setting = '', $sanitize = false, $hide_on_update = false )   X-Ref
Displays settings errors registered by add_settings_error().

Part of the Settings API. Outputs a div for each error retrieved by
get_settings_errors().

This is called automatically after a settings page based on the
Settings API is submitted. Errors should be added during the validation
callback function for a setting defined in register_setting().

The $sanitize option is passed into get_settings_errors() and will
re-run the setting sanitization
on its current value.

The $hide_on_update option will cause errors to only show when the settings
page is first loaded. if the user has already saved new values it will be
hidden to avoid repeating messages already shown in the default error
reporting after submission. This is useful to show general errors like
missing settings when the user arrives at the settings page.

since: 3.0.0
since: 5.3.0 Legacy `error` and `updated` CSS classes are mapped to
param: string $setting        Optional slug title of a specific setting whose errors you want.
param: bool   $sanitize       Whether to re-sanitize the setting value before returning errors.
param: bool   $hide_on_update If set to true errors will not be shown if the settings page has

find_posts_div( $found_action = '' )   X-Ref
Outputs the modal window used for attaching media to posts or pages in the media-listing screen.

since: 2.7.0
param: string $found_action

the_post_password()   X-Ref
Displays the post password.

The password is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.

since: 2.7.0

_draft_or_post_title( $post = 0 )   X-Ref
Gets the post title.

The post title is fetched and if it is blank then a default string is
returned.

since: 2.7.0
return: string The post title if set.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

_admin_search_query()   X-Ref
Displays the search query.

A simple wrapper to display the "s" parameter in a `GET` URI. This function
should only be used when the_search_query() cannot.

since: 2.7.0

iframe_header( $title = '', $deprecated = false )   X-Ref
Generic Iframe header for use with Thickbox.

since: 2.7.0
param: string $title      Optional. Title of the Iframe page. Default empty.
param: bool   $deprecated Not used.

tb_close()   X-Ref
No description

iframe_footer()   X-Ref
Generic Iframe footer for use with Thickbox.

since: 2.7.0

_post_states( $post, $display = true )   X-Ref
Echoes or returns the post states as HTML.

since: 2.7.0
since: 5.3.0 Added the `$display` parameter and a return value.
return: string Post states string.
param: WP_Post $post    The post to retrieve states for.
param: bool    $display Optional. Whether to display the post states as an HTML string.

get_post_states( $post )   X-Ref
Retrieves an array of post states from a post.

since: 5.3.0
return: string[] Array of post state labels keyed by their state.
param: WP_Post $post The post to retrieve states for.

_media_states( $post, $display = true )   X-Ref
Outputs the attachment media states as HTML.

since: 3.2.0
since: 5.6.0 Added the `$display` parameter and a return value.
return: string Media states string.
param: WP_Post $post    The attachment post to retrieve states for.
param: bool    $display Optional. Whether to display the post states as an HTML string.

get_media_states( $post )   X-Ref
Retrieves an array of media states from an attachment.

since: 5.6.0
return: string[] Array of media state labels keyed by their state.
param: WP_Post $post The attachment to retrieve states for.

compression_test()   X-Ref
Tests support for compressing JavaScript from PHP.

Outputs JavaScript that tests if compression from PHP works as expected
and sets an option with the result. Has no effect when the current user
is not an administrator. To run the test again the option 'can_compress_scripts'
has to be deleted.

since: 2.8.0

submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null )   X-Ref
Echoes a submit button, with provided text and appropriate class(es).

since: 3.1.0
param: string       $text             The text of the button (defaults to 'Save Changes')
param: string       $type             Optional. The type and CSS class(es) of the button. Core values
param: string       $name             The HTML name of the submit button. Defaults to "submit". If no
param: bool         $wrap             True if the output button should be wrapped in a paragraph tag,
param: array|string $other_attributes Other attributes that should be output with the button, mapping

get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' )   X-Ref
Returns a submit button, with provided text and appropriate class.

since: 3.1.0
return: string Submit button HTML.
param: string       $text             Optional. The text of the button. Default 'Save Changes'.
param: string       $type             Optional. The type and CSS class(es) of the button. Core values
param: string       $name             Optional. The HTML name of the submit button. Defaults to "submit".
param: bool         $wrap             Optional. True if the output button should be wrapped in a paragraph
param: array|string $other_attributes Optional. Other attributes that should be output with the button,

_wp_admin_html_begin()   X-Ref


convert_to_screen( $hook_name )   X-Ref
Converts a screen string to a screen object.

since: 3.0.0
return: WP_Screen Screen object.
param: string $hook_name The hook name (also known as the hook suffix) used to determine the screen.

_local_storage_notice()   X-Ref
Output the HTML for restoring the post data from DOM storage

since: 3.6.0

wp_star_rating( $args = array()   X-Ref
Outputs a HTML element with a star rating for a given rating.

Outputs a HTML element with the star rating exposed on a 0..5 scale in
half star increments (ie. 1, 1.5, 2 stars). Optionally, if specified, the
number of ratings may also be displayed by passing the $number parameter.

since: 3.8.0
since: 4.4.0 Introduced the `echo` parameter.
return: string Star rating HTML.
param: array $args {

_wp_posts_page_notice()   X-Ref
Outputs a notice when editing the page for posts (internal use only).

since: 4.2.0

_wp_block_editor_posts_page_notice()   X-Ref
Outputs a notice when editing the page for posts in the block editor (internal use only).

since: 5.8.0



Generated: Tue Mar 19 01:00:02 2024 Cross-referenced by PHPXref 0.7.1