[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Post Template Functions. Gets content for the current post in the loop.

File Size: 1994 lines (65 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 wp-includes/class-phpass.php

Defines 37 functions

  the_ID()
  get_the_ID()
  the_title()
  the_title_attribute()
  get_the_title()
  the_guid()
  get_the_guid()
  the_content()
  get_the_content()
  the_excerpt()
  get_the_excerpt()
  has_excerpt()
  post_class()
  get_post_class()
  body_class()
  get_body_class()
  post_password_required()
  wp_link_pages()
  _wp_link_page()
  post_custom()
  the_meta()
  wp_dropdown_pages()
  wp_list_pages()
  wp_page_menu()
  walk_page_tree()
  walk_page_dropdown_tree()
  the_attachment_link()
  wp_get_attachment_link()
  prepend_attachment()
  get_the_password_form()
  is_page_template()
  get_page_template_slug()
  wp_post_revision_title()
  wp_post_revision_title_expanded()
  wp_list_post_revisions()
  get_post_parent()
  has_post_parent()

Functions
Functions that are not part of a class:

the_ID()   X-Ref
Displays the ID of the current item in the WordPress Loop.

since: 0.71

get_the_ID()   X-Ref
Retrieves the ID of the current item in the WordPress Loop.

since: 2.1.0
return: int|false The ID of the current item in the WordPress Loop. False if $post is not set.

the_title( $before = '', $after = '', $echo = true )   X-Ref
Displays or retrieves the current post title with optional markup.

since: 0.71
return: void|string Void if `$echo` argument is true, current post title if `$echo` is false.
param: string $before Optional. Markup to prepend to the title. Default empty.
param: string $after  Optional. Markup to append to the title. Default empty.
param: bool   $echo   Optional. Whether to echo or return the title. Default true for echo.

the_title_attribute( $args = '' )   X-Ref
Sanitizes the current title when retrieving or displaying.

Works like the_title(), except the parameters can be in a string or
an array. See the function for what can be override in the $args parameter.

The title before it is displayed will have the tags stripped and esc_attr()
before it is passed to the user or displayed. The default as with the_title(),
is to display the title.

since: 2.3.0
return: void|string Void if 'echo' argument is true, the title attribute if 'echo' is false.
param: string|array $args {

get_the_title( $post = 0 )   X-Ref
Retrieves the post title.

If the post is protected and the visitor is not an admin, then "Protected"
will be inserted before the post title. If the post is private, then
"Private" will be inserted before the post title.

since: 0.71
return: string
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

the_guid( $post = 0 )   X-Ref
Displays the Post Global Unique Identifier (guid).

The guid will appear to be a link, but should not be used as a link to the
post. The reason you should not use it as a link, is because of moving the
blog across domains.

URL is escaped to make it XML-safe.

since: 1.5.0
param: int|WP_Post $post Optional. Post ID or post object. Default is global $post.

get_the_guid( $post = 0 )   X-Ref
Retrieves the Post Global Unique Identifier (guid).

The guid will appear to be a link, but should not be used as an link to the
post. The reason you should not use it as a link, is because of moving the
blog across domains.

since: 1.5.0
return: string
param: int|WP_Post $post Optional. Post ID or post object. Default is global $post.

the_content( $more_link_text = null, $strip_teaser = false )   X-Ref
Displays the post content.

since: 0.71
param: string $more_link_text Optional. Content for when there is more text.
param: bool   $strip_teaser   Optional. Strip teaser content before the more text. Default false.

get_the_content( $more_link_text = null, $strip_teaser = false, $post = null )   X-Ref
Retrieves the post content.

since: 0.71
since: 5.2.0 Added the `$post` parameter.
return: string
param: string             $more_link_text Optional. Content for when there is more text.
param: bool               $strip_teaser   Optional. Strip teaser content before the more text. Default false.
param: WP_Post|object|int $post           Optional. WP_Post instance or Post ID/object. Default null.

the_excerpt()   X-Ref
Displays the post excerpt.

since: 0.71

get_the_excerpt( $post = null )   X-Ref
Retrieves the post excerpt.

since: 0.71
since: 4.5.0 Introduced the `$post` parameter.
return: string Post excerpt.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

has_excerpt( $post = 0 )   X-Ref
Determines whether the post has a custom excerpt.

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.

since: 2.3.0
return: bool True if the post has a custom excerpt, false otherwise.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

post_class( $class = '', $post_id = null )   X-Ref
Displays the classes for the post container element.

since: 2.7.0
param: string|string[] $class   One or more classes to add to the class list.
param: int|WP_Post     $post_id Optional. Post ID or post object. Defaults to the global `$post`.

get_post_class( $class = '', $post_id = null )   X-Ref
Retrieves an array of the class names for the post container element.

The class names are many. If the post is a sticky, then the 'sticky'
class name. The class 'hentry' is always added to each post. If the post has a
post thumbnail, 'has-post-thumbnail' is added as a class. For each taxonomy that
the post belongs to, a class will be added of the format '{$taxonomy}-{$slug}' -
eg 'category-foo' or 'my_custom_taxonomy-bar'.

The 'post_tag' taxonomy is a special
case; the class has the 'tag-' prefix instead of 'post_tag-'. All class names are
passed through the filter, {@see 'post_class'}, with the list of class names, followed by
$class parameter value, with the post ID as the last parameter.

since: 2.7.0
since: 4.2.0 Custom taxonomy class names were added.
return: string[] Array of class names.
param: string|string[] $class   Space-separated string or array of class names to add to the class list.
param: int|WP_Post     $post_id Optional. Post ID or post object.

body_class( $class = '' )   X-Ref
Displays the class names for the body element.

since: 2.8.0
param: string|string[] $class Space-separated string or array of class names to add to the class list.

get_body_class( $class = '' )   X-Ref
Retrieves an array of the class names for the body element.

since: 2.8.0
return: string[] Array of class names.
param: string|string[] $class Space-separated string or array of class names to add to the class list.

post_password_required( $post = null )   X-Ref
Determines whether the post requires password and whether a correct password has been provided.

since: 2.7.0
return: bool false if a password is not required or the correct password cookie is present, true otherwise.
param: int|WP_Post|null $post An optional post. Global $post used if not provided.

wp_link_pages( $args = '' )   X-Ref
The formatted output of a list of pages.

Displays page links for paginated posts (i.e. including the `<!--nextpage-->`
Quicktag one or more times). This tag must be within The Loop.

since: 1.2.0
since: 5.1.0 Added the `aria_current` argument.
return: string Formatted output in HTML.
param: string|array $args {

_wp_link_page( $i )   X-Ref
Helper function for wp_link_pages().

since: 3.1.0
return: string Link.
param: int $i Page number.

post_custom( $key = '' )   X-Ref
Retrieves post custom meta data field.

since: 1.5.0
return: array|string|false Array of values, or single value if only one element exists.
param: string $key Meta data key name.

the_meta()   X-Ref
Displays a list of post custom fields.

since: 1.2.0

wp_dropdown_pages( $args = '' )   X-Ref
Retrieves or displays a list of pages as a dropdown (select list).

since: 2.1.0
since: 4.2.0 The `$value_field` argument was added.
since: 4.3.0 The `$class` argument was added.
return: string HTML dropdown list of pages.
param: array|string $args {

wp_list_pages( $args = '' )   X-Ref
Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format.

since: 1.5.0
since: 4.7.0 Added the `item_spacing` argument.
return: void|string Void if 'echo' argument is true, HTML list of pages if 'echo' is false.
param: array|string $args {

wp_page_menu( $args = array()   X-Ref
Displays or retrieves a list of pages with an optional home link.

The arguments are listed below and part of the arguments are for wp_list_pages() function.
Check that function for more info on those arguments.

since: 2.7.0
since: 4.4.0 Added `menu_id`, `container`, `before`, `after`, and `walker` arguments.
since: 4.7.0 Added the `item_spacing` argument.
return: void|string Void if 'echo' argument is true, HTML menu if 'echo' is false.
param: array|string $args {

walk_page_tree( $pages, $depth, $current_page, $args )   X-Ref
Retrieves HTML list content for page list.

since: 2.1.0
return: string
param: array $pages
param: int   $depth
param: int   $current_page
param: array $args

walk_page_dropdown_tree( ...$args )   X-Ref
Retrieves HTML dropdown (select) content for page list.

since: 2.1.0
since: 5.3.0 Formalized the existing `...$args` parameter by adding it
return: string
param: mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.

the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false )   X-Ref
Displays an attachment page link using an image or icon.

since: 2.0.0
param: int|WP_Post $id Optional. Post ID or post object.
param: bool        $fullsize     Optional. Whether to use full size. Default false.
param: bool        $deprecated   Deprecated. Not used.
param: bool        $permalink    Optional. Whether to include permalink. Default false.

wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' )   X-Ref
Retrieves an attachment page link using an image or icon, if possible.

since: 2.5.0
since: 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
return: string HTML content.
param: int|WP_Post  $id        Optional. Post ID or post object.
param: string|int[] $size      Optional. Image size. Accepts any registered image size name, or an array
param: bool         $permalink Optional. Whether to add permalink to image. Default false.
param: bool         $icon      Optional. Whether the attachment is an icon. Default false.
param: string|false $text      Optional. Link text to use. Activated by passing a string, false otherwise.
param: array|string $attr      Optional. Array or string of attributes. Default empty.

prepend_attachment( $content )   X-Ref
Wraps attachment in paragraph tag before content.

since: 2.0.0
return: string
param: string $content

get_the_password_form( $post = 0 )   X-Ref
Retrieves protected post password form content.

since: 1.0.0
return: string HTML content for password form for password protected post.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

is_page_template( $template = '' )   X-Ref
Determines whether the current post uses a page template.

This template tag allows you to determine if you are in a page template.
You can optionally provide a template filename or array of template filenames
and then the check will be specific to that template.

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.

since: 2.5.0
since: 4.2.0 The `$template` parameter was changed to also accept an array of page templates.
since: 4.7.0 Now works with any post type, not just pages.
return: bool True on success, false on failure.
param: string|string[] $template The specific template filename or array of templates to match.

get_page_template_slug( $post = null )   X-Ref
Gets the specific template filename for a given post.

since: 3.4.0
since: 4.7.0 Now works with any post type, not just pages.
return: string|false Page template filename. Returns an empty string when the default page template
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

wp_post_revision_title( $revision, $link = true )   X-Ref
Retrieves formatted date timestamp of a revision (linked to that revisions's page).

since: 2.6.0
return: string|false i18n formatted datetimestamp or localized 'Current Revision'.
param: int|object $revision Revision ID or revision object.
param: bool       $link     Optional. Whether to link to revision's page. Default true.

wp_post_revision_title_expanded( $revision, $link = true )   X-Ref
Retrieves formatted date timestamp of a revision (linked to that revisions's page).

since: 3.6.0
return: string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
param: int|object $revision Revision ID or revision object.
param: bool       $link     Optional. Whether to link to revision's page. Default true.

wp_list_post_revisions( $post_id = 0, $type = 'all' )   X-Ref
Displays a list of a post's revisions.

Can output either a UL with edit links or a TABLE with diff interface, and
restore action links.

since: 2.6.0
param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
param: string      $type    'all' (default), 'revision' or 'autosave'

get_post_parent( $post = null )   X-Ref
Retrieves the parent post object for the given post.

since: 5.7.0
return: WP_Post|null Parent post object, or null if there isn't one.
param: int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.

has_post_parent( $post = null )   X-Ref
Returns whether the given post has a parent post.

since: 5.7.0
return: bool Whether the post has a parent post.
param: int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.



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