[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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: 2822 lines (99 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 2 files
 wp-admin/includes/class-wp-internal-pointers.php
 wp-admin/includes/class-walker-category-checklist.php

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.

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().

param: int          $post_id Optional. Post ID. Default 0.
param: array|string $args {
return: string HTML list of input elements.

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.

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.
return: int[] Array of popular term IDs.

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

param: int $link_id Optional. The link ID. Default 0.

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

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.

param: int    $position  Optional. The value of the 'position' input field. Default 1.
param: bool   $checkbox  Optional. The value of the 'checkbox' input field. Default false.
param: string $mode      Optional. If set to 'single', will use WP_Post_Comments_List_Table,
param: bool   $table_row Optional. Whether to use a table instead of a div element. Default true.

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


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

param: array[] $meta An array of meta data arrays keyed on 'meta_key' and 'meta_value'.

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

param: array $entry An array of meta data keyed on 'meta_key' and 'meta_value'.
param: int   $count Reference to the row number.
return: string A single row of public meta data.

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

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.

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.

param: string $default_template Optional. The template file name. Default empty.
param: string $post_type        Optional. Post type to get templates for. Default 'page'.

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.

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.
return: void|false Void on success, false if the page has no children.

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

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.

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.

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.

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.

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

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

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.
return: int Number of meta_boxes.

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

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.

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.
return: int Number of meta boxes as accordion sections.

add_settings_section( $id, $title, $callback, $page, $args = array()   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.

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
param: array    $args     {

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.

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()

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.

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.

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).

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.
return: array[] {

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.

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.

param: string $found_action Optional. The value of the 'found_action' input field. Default empty string.

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.


_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.

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

_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.


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

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.


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

param: WP_Post $post    The post to retrieve states for.
param: bool    $display Optional. Whether to display the post states as an HTML string.
return: string Post states string.

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

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

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

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.
return: string Media states string.

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

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

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.


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

param: string       $text             Optional. 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             Optional. The HTML name of the submit button. If no `id` attribute
param: bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
param: array|string $other_attributes Optional. Other attributes that should be output with the button,

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.

param: string       $text             Optional. 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             Optional. The HTML name of the submit button. If no `id` attribute
param: bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
param: array|string $other_attributes Optional. Other attributes that should be output with the button,
return: string Submit button HTML.

_wp_admin_html_begin()   X-Ref
Prints out the beginning of the admin HTML header.


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

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

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


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.

param: array $args {
return: string Star rating HTML.

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


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




Generated : Tue Dec 24 08:20:01 2024 Cross-referenced by PHPXref