<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27676] trunk/src/wp-includes/post-template.php: Inline documentation for hooks in wp-includes/post-template.php.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27676">27676</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-03-24 03:36:36 +0000 (Mon, 24 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-includes/post-template.php.
Props Toru and kpdesign.
Fixes <a href="http://core.trac.wordpress.org/ticket/25621">#25621</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesposttemplatephp">trunk/src/wp-includes/post-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/post-template.php (27675 => 27676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post-template.php 2014-03-24 03:24:33 UTC (rev 27675)
+++ trunk/src/wp-includes/post-template.php 2014-03-24 03:36:36 UTC (rev 27676)
</span><span class="lines">@@ -107,14 +107,44 @@
</span><span class="cx">
</span><span class="cx"> if ( ! is_admin() ) {
</span><span class="cx"> if ( ! empty( $post->post_password ) ) {
</span><ins>+
+ /**
+ * Filter the text prepended to the post title for protected posts.
+ *
+ * The filter is only applied on the front end.
+ *
+ * @since 2.8.0
+ *
+ * @param string $prepend Text displayed before the post title.
+ * Default 'Protected: %s'.
+ */
</ins><span class="cx"> $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) );
</span><span class="cx"> $title = sprintf( $protected_title_format, $title );
</span><span class="cx"> } else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {
</span><ins>+
+ /**
+ * Filter the text prepended to the post title of private posts.
+ *
+ * The filter is only applied on the front end.
+ *
+ * @since 2.8.0
+ *
+ * @param string $prepend Text displayed before the post title.
+ * Default 'Private: %s'.
+ */
</ins><span class="cx"> $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) );
</span><span class="cx"> $title = sprintf( $private_title_format, $title );
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the post title.
+ *
+ * @since 0.71
+ *
+ * @param string $title The post title.
+ * @param int $id The post ID.
+ */
</ins><span class="cx"> return apply_filters( 'the_title', $title, $id );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -150,7 +180,14 @@
</span><span class="cx"> function get_the_guid( $id = 0 ) {
</span><span class="cx"> $post = get_post($id);
</span><span class="cx">
</span><del>- return apply_filters('get_the_guid', $post->guid);
</del><ins>+ /**
+ * Filter the Global Unique Identifier (guid) of the post.
+ *
+ * @since 1.5.0
+ *
+ * @param string $post_guid Global Unique Identifier (guid) of the post.
+ */
+ return apply_filters( 'get_the_guid', $post->guid );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -163,6 +200,14 @@
</span><span class="cx"> */
</span><span class="cx"> function the_content( $more_link_text = null, $strip_teaser = false) {
</span><span class="cx"> $content = get_the_content( $more_link_text, $strip_teaser );
</span><ins>+
+ /**
+ * Filter the post content.
+ *
+ * @since 0.71
+ *
+ * @param string $content Content of the current post.
+ */
</ins><span class="cx"> $content = apply_filters( 'the_content', $content );
</span><span class="cx"> $content = str_replace( ']]>', ']]>', $content );
</span><span class="cx"> echo $content;
</span><span class="lines">@@ -221,6 +266,15 @@
</span><span class="cx"> $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
</span><span class="cx"> } else {
</span><span class="cx"> if ( ! empty( $more_link_text ) )
</span><ins>+
+ /**
+ * Filter the Read More link text.
+ *
+ * @since 2.8.0
+ *
+ * @param string $more_link_element Read More link element.
+ * @param string $more_link_text Read More text.
+ */
</ins><span class="cx"> $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
</span><span class="cx"> $output = force_balance_tags( $output );
</span><span class="cx"> }
</span><span class="lines">@@ -248,10 +302,19 @@
</span><span class="cx"> * Display the post excerpt.
</span><span class="cx"> *
</span><span class="cx"> * @since 0.71
</span><del>- * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt.
</del><span class="cx"> */
</span><span class="cx"> function the_excerpt() {
</span><del>- echo apply_filters('the_excerpt', get_the_excerpt());
</del><ins>+
+ /**
+ * Filter the displayed post excerpt.
+ *
+ * @since 0.71
+ *
+ * @see get_the_excerpt()
+ *
+ * @param string $post_excerpt The post excerpt.
+ */
+ echo apply_filters( 'the_excerpt', get_the_excerpt() );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -272,6 +335,13 @@
</span><span class="cx"> return __( 'There is no excerpt because this is a protected post.' );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the retrieved post excerpt.
+ *
+ * @since 1.2.0
+ *
+ * @param string $post_excerpt The post excerpt.
+ */
</ins><span class="cx"> return apply_filters( 'get_the_excerpt', $post->post_excerpt );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -384,7 +454,16 @@
</span><span class="cx">
</span><span class="cx"> $classes = array_map('esc_attr', $classes);
</span><span class="cx">
</span><del>- return apply_filters('post_class', $classes, $class, $post->ID);
</del><ins>+ /**
+ * Filter the list of CSS classes for the current post.
+ *
+ * @since 2.7.0
+ *
+ * @param array $classes An array of post classes.
+ * @param string $class A comma-separated list of additional classes added to the post.
+ * @param int $post_id The post ID.
+ */
+ return apply_filters( 'post_class', $classes, $class, $post->ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -568,6 +647,14 @@
</span><span class="cx">
</span><span class="cx"> $classes = array_map( 'esc_attr', $classes );
</span><span class="cx">
</span><ins>+ /**
+ * Filter the list of CSS body classes for the current post or page.
+ *
+ * @since 2.8.0
+ *
+ * @param array $classes An array of body classes.
+ * @param string $class A comma-separated list of additional classes added to the body.
+ */
</ins><span class="cx"> return apply_filters( 'body_class', $classes, $class );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -652,6 +739,14 @@
</span><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> $r = wp_parse_args( $args, $defaults );
</span><ins>+
+ /**
+ * Filter the arguments used in retrieving page links for paginated posts.
+ *
+ * @since 3.0.0
+ *
+ * @param array $r An array of arguments for page links for paginated posts.
+ */
</ins><span class="cx"> $r = apply_filters( 'wp_link_pages_args', $r );
</span><span class="cx"> extract( $r, EXTR_SKIP );
</span><span class="cx">
</span><span class="lines">@@ -665,6 +760,15 @@
</span><span class="cx"> $link = $link_before . str_replace( '%', $i, $pagelink ) . $link_after;
</span><span class="cx"> if ( $i != $page || ! $more && 1 == $page )
</span><span class="cx"> $link = _wp_link_page( $i ) . $link . '</a>';
</span><ins>+
+ /**
+ * Filter the HTML output of individual page number links.
+ *
+ * @since 3.6.0
+ *
+ * @param string $link The page number HTML output.
+ * @param int $i Page number for paginated posts' page links.
+ */
</ins><span class="cx"> $link = apply_filters( 'wp_link_pages_link', $link, $i );
</span><span class="cx"> $output .= $separator . $link;
</span><span class="cx"> }
</span><span class="lines">@@ -674,12 +778,16 @@
</span><span class="cx"> $i = $page - 1;
</span><span class="cx"> if ( $i ) {
</span><span class="cx"> $link = _wp_link_page( $i ) . $link_before . $previouspagelink . $link_after . '</a>';
</span><ins>+
+ /** This filter is documented in wp-includes/post-template.php */
</ins><span class="cx"> $link = apply_filters( 'wp_link_pages_link', $link, $i );
</span><span class="cx"> $output .= $separator . $link;
</span><span class="cx"> }
</span><span class="cx"> $i = $page + 1;
</span><span class="cx"> if ( $i <= $numpages ) {
</span><span class="cx"> $link = _wp_link_page( $i ) . $link_before . $nextpagelink . $link_after . '</a>';
</span><ins>+
+ /** This filter is documented in wp-includes/post-template.php */
</ins><span class="cx"> $link = apply_filters( 'wp_link_pages_link', $link, $i );
</span><span class="cx"> $output .= $separator . $link;
</span><span class="cx"> }
</span><span class="lines">@@ -687,6 +795,14 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the HTML output of page links for paginated posts.
+ *
+ * @since 3.6.0
+ *
+ * @param string $output HTML output of paginated posts' page links.
+ * @param array $args An array of arguments.
+ */
</ins><span class="cx"> $output = apply_filters( 'wp_link_pages', $output, $args );
</span><span class="cx">
</span><span class="cx"> if ( $echo )
</span><span class="lines">@@ -774,7 +890,17 @@
</span><span class="cx"> continue;
</span><span class="cx"> $values = array_map('trim', get_post_custom_values($key));
</span><span class="cx"> $value = implode($values,', ');
</span><del>- echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
</del><ins>+
+ /**
+ * Filter the HTML output of the li element in the post custom fields list.
+ *
+ * @since 2.2.0
+ *
+ * @param string $html The HTML output for the li element.
+ * @param string $key Meta key.
+ * @param string $value Meta value.
+ */
+ echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
</ins><span class="cx"> }
</span><span class="cx"> echo "</ul>\n";
</span><span class="cx"> }
</span><span class="lines">@@ -820,7 +946,14 @@
</span><span class="cx"> $output .= "</select>\n";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $output = apply_filters('wp_dropdown_pages', $output);
</del><ins>+ /**
+ * Filter the HTML output of a list of pages as a drop down.
+ *
+ * @since 2.1.0
+ *
+ * @param string $output HTML output for drop down list of pages.
+ */
+ $output = apply_filters( 'wp_dropdown_pages', $output );
</ins><span class="cx">
</span><span class="cx"> if ( $echo )
</span><span class="cx"> echo $output;
</span><span class="lines">@@ -857,8 +990,16 @@
</span><span class="cx">
</span><span class="cx"> // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
</span><span class="cx"> $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();
</span><del>- $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) );
</del><span class="cx">
</span><ins>+ /**
+ * Filter the array of pages to exclude from the pages list.
+ *
+ * @since 2.1.0
+ *
+ * @param array $exclude_array An array of page IDs to exclude.
+ */
+ $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
+
</ins><span class="cx"> // Query pages.
</span><span class="cx"> $r['hierarchical'] = 0;
</span><span class="cx"> $pages = get_pages($r);
</span><span class="lines">@@ -876,7 +1017,17 @@
</span><span class="cx"> $output .= '</ul></li>';
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $output = apply_filters('wp_list_pages', $output, $r);
</del><ins>+ /**
+ * Filter the HTML output of the pages to list.
+ *
+ * @since 1.5.1
+ *
+ * @see wp_list_pages()
+ *
+ * @param string $output HTML output of the pages list.
+ * @param array $r An array of page-listing arguments.
+ */
+ $output = apply_filters( 'wp_list_pages', $output, $r );
</ins><span class="cx">
</span><span class="cx"> if ( $r['echo'] )
</span><span class="cx"> echo $output;
</span><span class="lines">@@ -913,6 +1064,16 @@
</span><span class="cx"> function wp_page_menu( $args = array() ) {
</span><span class="cx"> $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
</span><span class="cx"> $args = wp_parse_args( $args, $defaults );
</span><ins>+
+ /**
+ * Filter the arguments used to generate a page-based menu.
+ *
+ * @since 2.7.0
+ *
+ * @see wp_page_menu()
+ *
+ * @param array $args An array of page menu arguments.
+ */
</ins><span class="cx"> $args = apply_filters( 'wp_page_menu_args', $args );
</span><span class="cx">
</span><span class="cx"> $menu = '';
</span><span class="lines">@@ -948,6 +1109,17 @@
</span><span class="cx"> $menu = '<ul>' . $menu . '</ul>';
</span><span class="cx">
</span><span class="cx"> $menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
</span><ins>+
+ /**
+ * Filter the HTML output of a page-based menu.
+ *
+ * @since 2.7.0
+ *
+ * @see wp_page_menu()
+ *
+ * @param string $menu The HTML output.
+ * @param array $args An array of arguments.
+ */
</ins><span class="cx"> $menu = apply_filters( 'wp_page_menu', $menu, $args );
</span><span class="cx"> if ( $args['echo'] )
</span><span class="cx"> echo $menu;
</span><span class="lines">@@ -1080,6 +1252,20 @@
</span><span class="cx"> $css_class[] = 'current_page_parent';
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the list of CSS classes to include with each page item in the list.
+ *
+ * @since 2.8.0
+ *
+ * @see wp_list_pages()
+ *
+ * @param array $css_class An array of CSS classes to be applied
+ * to each list item.
+ * @param WP_Post $page Page data object.
+ * @param int $depth Depth of page, used for padding.
+ * @param array $args An array of arguments.
+ * @param int $current_page ID of the current page.
+ */
</ins><span class="cx"> $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
</span><span class="cx">
</span><span class="cx"> if ( '' === $page->post_title )
</span><span class="lines">@@ -1158,6 +1344,14 @@
</span><span class="cx"> $title = sprintf( __( '#%d (no title)' ), $page->ID );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the page title when creating an HTML drop-down list of pages.
+ *
+ * @since 3.1.0
+ *
+ * @param string $title Page title.
+ * @param object $page Page data object.
+ */
</ins><span class="cx"> $title = apply_filters( 'list_pages', $title, $page );
</span><span class="cx"> $output .= $pad . esc_html( $title );
</span><span class="cx"> $output .= "</option>\n";
</span><span class="lines">@@ -1223,6 +1417,18 @@
</span><span class="cx"> if ( trim( $link_text ) == '' )
</span><span class="cx"> $link_text = $_post->post_title;
</span><span class="cx">
</span><ins>+ /**
+ * Filter a retrieved attachment page link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link_html The page link HTML output.
+ * @param int $id Post ID.
+ * @param string $size Image size. Default 'thumbnail'.
+ * @param bool $permalink Whether to add permalink to image. Default false.
+ * @param bool $icon Whether to include an icon. Default false.
+ * @param string|bool $text If string, will be link text. Default false.
+ */
</ins><span class="cx"> return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1230,7 +1436,6 @@
</span><span class="cx"> * Wrap attachment in <<p>> element before content.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><del>- * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content.
</del><span class="cx"> *
</span><span class="cx"> * @param string $content
</span><span class="cx"> * @return string
</span><span class="lines">@@ -1258,7 +1463,16 @@
</span><span class="cx"> $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
</span><span class="cx"> endif;
</span><span class="cx">
</span><del>- $p = apply_filters('prepend_attachment', $p);
</del><ins>+ /**
+ * Filter the attachment markup to be prepended to the post content.
+ *
+ * @since 2.0.0
+ *
+ * @see prepend_attachment()
+ *
+ * @param string $p The attachment HTML output.
+ */
+ $p = apply_filters( 'prepend_attachment', $p );
</ins><span class="cx">
</span><span class="cx"> return "$p\n$content";
</span><span class="cx"> }
</span><span class="lines">@@ -1282,6 +1496,18 @@
</span><span class="cx"> <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
</span><span class="cx"> <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__( 'Submit' ) . '" /></p></form>
</span><span class="cx"> ';
</span><ins>+
+ /**
+ * Filter the HTML output for the protected post password form.
+ *
+ * If modifying the password field, please note that the core database schema
+ * limits the password field to 20 characters regardless of the value of the
+ * size attribute in the form input.
+ *
+ * @since 2.7.0
+ *
+ * @param string $output The password form HTML output.
+ */
</ins><span class="cx"> return apply_filters( 'the_password_form', $output );
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>