/wp-includes/post-template.php

Description

WordPress Post Template Functions.

Gets content for the current post in the loop.

Classes
Class Description
Walker_Page Create HTML list of pages.
Walker_PageDropdown Create HTML dropdown list of pages.
Functions
body_class (line 385)

Display the classes for the body element.

  • since: 2.8.0
void body_class ([string|array $class = ''])
  • string|array $class: One or more classes to add to the class list.
get_body_class (line 398)

Retrieve the classes for the body element as an array.

  • return: Array of classes.
  • since: 2.8.0
array get_body_class ([string|array $class = ''])
  • string|array $class: One or more classes to add to the class list.
get_page_template_slug (line 1268)

Get the specific template name for a page.

  • return: Page template filename. Returns an empty string when the default page template is in use. Returns false if the post is not a page.
  • since: 3.4.0
string|bool get_page_template_slug ([ $post_id = null], int $id)
  • int $id: The page ID to check. Defaults to the current post, when used in the loop.
  • $post_id
get_post_class (line 315)

Retrieve the classes for the post div as an array.

The class names are add are many. If the post is a sticky, then the 'sticky' class name. The class 'hentry' is always added to each post. For each category, the class will be added with 'category-' with category slug is added. The tags are the same way as the categories with 'tag-' before the tag slug. All classes are passed through the filter, 'post_class' with the list of classes, followed by $class parameter value, with the post ID as the last parameter.

  • return: Array of classes.
  • since: 2.7.0
array get_post_class ([string|array $class = ''], [int $post_id = null])
  • string|array $class: One or more classes to add to the class list.
  • int $post_id: An optional post ID.
get_the_content (line 180)

Retrieve the post content.

  • since: 0.71
string get_the_content ([string $more_link_text = null], [bool $stripteaser = false])
  • string $more_link_text: Optional. Content for when there is more text.
  • bool $stripteaser: Optional. Strip teaser content before the more text. Default is false.
get_the_excerpt (line 258)

Retrieve the post excerpt.

  • since: 0.71
string get_the_excerpt ([mixed $deprecated = ''])
  • mixed $deprecated: Not used.
get_the_guid (line 150)

Retrieve 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
string get_the_guid ([int $id = 0])
  • int $id: Optional. Post ID.
get_the_ID (line 28)

Retrieve the ID of the current item in the WordPress Loop.

  • since: 2.1.0
  • uses: $post
int get_the_ID ()
get_the_password_form (line 1217)

Retrieve protected post password form content.

  • return: HTML content for password form for password protected post.
  • since: 1.0.0
  • uses: apply_filters() - Calls 'the_password_form' filter on output.
string get_the_password_form ()
get_the_title (line 103)

Retrieve post title.

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

  • since: 0.71
string get_the_title ([int $id = 0])
  • int $id: Optional. Post ID.
has_excerpt (line 280)

Whether post has excerpt.

  • since: 2.3.0
bool has_excerpt ([int $id = 0])
  • int $id: Optional. Post ID.
is_page_template (line 1241)

Whether currently in a page template.

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

  • return: False on failure, true if success.
  • since: 2.5.0
  • uses: $wp_query
bool is_page_template ([string $template = ''])
  • string $template: The specific template name if specific matching is required.
post_class (line 293)

Display the classes for the post div.

  • since: 2.7.0
void post_class ([string|array $class = ''], [int $post_id = null])
  • string|array $class: One or more classes to add to the class list.
  • int $post_id: An optional post ID.
post_custom (line 723)

Retrieve post custom meta data field.

  • return: Array of values or single value, if only one element exists. False will be returned if key does not exist.
  • since: 1.5.0
bool|string|array post_custom ([string $key = ''])
  • string $key: Meta data key name.
post_password_required (line 555)

Whether post requires password and correct password has been provided.

  • return: false if a password is not required or the correct password cookie is present, true otherwise.
  • since: 2.7.0
bool post_password_required ([int|object  $post = null])
  • int|object $post: An optional post. Global $post used if not provided.
prepend_attachment (line 1190)

Wrap attachment in <p> element before content.

  • since: 2.0.0
  • uses: apply_filters() - Calls 'prepend_attachment' hook on HTML content.
string prepend_attachment (string $content)
  • string $content
sticky_class (line 584)

Display "sticky" CSS class, if a post is sticky.

  • since: 2.7.0
void sticky_class ([int $post_id = null])
  • int $post_id: An optional post ID.
the_attachment_link (line 1133)

Display an attachment page link using an image or icon.

  • since: 2.0.0
void the_attachment_link ([int $id = 0], [bool $fullsize = false], [bool $deprecated = false], [bool $permalink = false])
  • int $id: Optional. Post ID.
  • bool $fullsize: Optional, default is false. Whether to use full size.
  • bool $deprecated: Deprecated. Not used.
  • bool $permalink: Optional, default is false. Whether to include permalink.
the_content (line 164)

Display the post content.

  • since: 0.71
void the_content ([string $more_link_text = null], [bool $stripteaser = false])
  • string $more_link_text: Optional. Content for when there is more text.
  • bool $stripteaser: Optional. Strip teaser content before the more text. Default is false.
the_excerpt (line 246)

Display the post excerpt.

  • since: 0.71
  • uses: apply_filters() - Calls 'the_excerpt' hook on post excerpt.
void the_excerpt ()
the_guid (line 134)

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

Url is escaped to make it xml safe

  • since: 1.5.0
void the_guid ([int $id = 0])
  • int $id: Optional. Post ID.
the_ID (line 16)

Display the ID of the current item in the WordPress Loop.

  • since: 0.71
void the_ID ()
the_meta (line 741)

Display list of post custom fields.

  • since: 1.2.0
  • uses: apply_filters() - Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters.
void the_meta ()
the_title (line 43)

Display or retrieve the current post title with optional content.

  • return: Null on no title. String if $echo parameter is false.
  • since: 0.71
null|string the_title ([string $before = ''], [string $after = ''], [bool $echo = true])
  • string $before: Optional. Content to prepend to the title.
  • string $after: Optional. Content to append to the title.
  • bool $echo: Optional, default to true.Whether to display or return.
the_title_attribute (line 72)

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

  • return: Null on failure or display. String when echo is false.
  • since: 2.3.0
string|null the_title_attribute ([string|array $args = ''])
  • string|array $args: Optional. Override the defaults.
walk_page_dropdown_tree (line 958)

Retrieve HTML dropdown (select) content for page list.

  • see: Walker_PageDropdown::walk() for parameters and return description.
  • since: 2.1.0
  • uses: Walker_PageDropdown - to create HTML dropdown content.
void walk_page_dropdown_tree ()
walk_page_tree (line 941)

Retrieve HTML list content for page list.

  • see: Walker_Page::walk() for parameters and return description.
  • since: 2.1.0
  • uses: Walker_Page - to create HTML list content.
void walk_page_tree ( $pages,  $depth,  $current_page,  $r)
  • $pages
  • $depth
  • $current_page
  • $r
wp_dropdown_pages (line 768)

Retrieve or display list of pages as a dropdown (select list).

  • return: HTML content, if not displaying.
  • since: 2.1.0
string wp_dropdown_pages ([array|string $args = ''])
  • array|string $args: Optional. Override default arguments.
wp_get_attachment_link (line 1156)

Retrieve an attachment page link using an image or icon, if possible.

  • return: HTML content.
  • since: 2.5.0
  • uses: apply_filters() - Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
string wp_get_attachment_link ([int $id = 0], [string $size = 'thumbnail'], [bool $permalink = false], [bool $icon = false], [string $text = false])
  • int $id: Optional. Post ID.
  • string $size: Optional, default is 'thumbnail'. Size of image, either array or string.
  • bool $permalink: Optional, default is false. Whether to add permalink to image.
  • bool $icon: Optional, default is false. Whether to include icon.
  • string $text: Optional, default is false. If string, then will be link text.
wp_list_pages (line 812)

Retrieve or display list of pages in list (li) format.

  • return: HTML content, if not displaying.
  • since: 1.5.0
string wp_list_pages ([array|string $args = ''])
  • array|string $args: Optional. Override default arguments.
wp_list_post_revisions (line 1347)

Display list of a post's revisions.

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

Second argument controls parameters: (bool) parent : include the parent (the "Current Revision") in the list. (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' outputs TABLE with UI. (int) right : what revision is currently being viewed - used in form-table format. (int) left : what revision is currently being diffed against right - used in form-table format.

null wp_list_post_revisions ([int|object  $post_id = 0], [string|array $args = null])
  • int|object $post_id: Post ID or post object.
  • string|array $args: See description wp_parse_args().
wp_page_menu (line 885)

Display or retrieve list of pages with 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.

  • <strong>sort_column</strong> - How to sort the list of pages. Defaults to page title. Use column for posts table.
  • <strong>menu_class</strong> - Class to use for the div ID which contains the page list. Defaults to 'menu'.
  • <strong>echo</strong> - Whether to echo list or return it. Defaults to echo.
  • <strong>link_before</strong> - Text before show_home argument text.
  • <strong>link_after</strong> - Text after show_home argument text.
  • <strong>show_home</strong> - If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link.

  • since: 2.7.0
void wp_page_menu ([array|string $args = array()])
  • array|string $args
wp_post_revision_title (line 1291)

Retrieve formatted date timestamp of a revision (linked to that revisions's page).

string wp_post_revision_title (int|object  $revision, [bool $link = true])
  • int|object $revision: Revision ID or revision object.
  • bool $link: Optional, default is true. Link to revisions's page?

Documentation generated on Tue, 15 May 2012 23:18:02 +0000 by phpDocumentor 1.4.1