[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

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

File Size: 2040 lines (67 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.


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.

the_title( $before = '', $after = '', $display = 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   $display Optional. Whether to echo or return the title. Default true for echo.
return: void|string Void if `$display` argument is true or the title is empty,

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.

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

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.

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

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.

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

the_excerpt()   X-Ref
Displays the post excerpt.


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.

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.

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

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

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

The class names are many:

- If the post has a post thumbnail, `has-post-thumbnail` is added as a class.
- If the post is sticky, then the `sticky` class name is added.
- The class `hentry` is always added to each post.
- For each taxonomy that the post belongs to, a class will be added of the format
`{$taxonomy}-{$slug}`, e.g. `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'}, followed by
`$css_class` parameter value, with the post ID as the last parameter.

param: string|string[] $css_class Optional. Space-separated string or array of class names
param: int|WP_Post     $post      Optional. Post ID or post object.
return: string[] Array of class names.

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

param: string|string[] $css_class Optional. Space-separated string or array of class names

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

param: string|string[] $css_class Optional. Space-separated string or array of class names
return: string[] Array of class names.

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.

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.

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

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

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.

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


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.

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.

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.

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

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

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

param: int|WP_Post $post       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( $post = 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  $post      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.

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

param: string $content
return: string

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.

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.

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

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

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

wp_list_post_revisions( $post = 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 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.

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.

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.



Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref