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

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

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

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.
return: void|string Void if `$echo` argument is true, current post title if `$echo` is false.
since: 0.71

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.

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

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.

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

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.

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

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.

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

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

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.
since: 0.71

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

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.
return: string
since: 0.71
since: 5.2.0 Added the `$post` parameter.

the_excerpt()   X-Ref
Displays the post excerpt.

since: 0.71

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

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

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.

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

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

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`.
since: 2.7.0

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.

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.
return: string[] Array of class names.
since: 2.7.0
since: 4.2.0 Custom taxonomy class names were added.

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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.

param: array|string $args {
return: void|string Void if 'echo' argument is true, HTML menu if 'echo' is false.
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.

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

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

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

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

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

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.
since: 2.0.0

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.

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.
return: string HTML content.
since: 2.5.0
since: 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.

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

param: string $content
return: string
since: 2.0.0

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

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

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.

param: string|string[] $template The specific template filename or array of templates to match.
return: bool True on success, false on failure.
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.

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

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

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

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

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

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

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.

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'
since: 2.6.0

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

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

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

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



Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1