Standardize the post format theme API functions with the_post_format_THING() and get_the_post_format_THING().

fixes #23927

git-svn-id: http://core.svn.wordpress.org/trunk@23899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-04-04 08:09:02 +00:00
parent 2a38966a97
commit 15dc5a3718
8 changed files with 25 additions and 25 deletions

View File

@ -465,7 +465,7 @@ endif; // twentyeleven_content_nav
* @return string * @return string
*/ */
function twentyeleven_get_first_url() { function twentyeleven_get_first_url() {
$has_url = function_exists( 'get_the_url' ) ? get_the_url() : false; $has_url = function_exists( 'get_the_post_format_url' ) ? get_the_post_format_url() : false;
if ( ! $has_url ) if ( ! $has_url )
$has_url = twentyeleven_url_grabber(); $has_url = twentyeleven_url_grabber();

View File

@ -21,7 +21,7 @@
<div class="entry-media"> <div class="entry-media">
<div class="audio-content"> <div class="audio-content">
<?php the_audio(); ?> <?php the_post_format_audio(); ?>
</div><!-- .audio-content --> </div><!-- .audio-content -->
</div><!-- .entry-media --> </div><!-- .entry-media -->

View File

@ -20,7 +20,7 @@
</header><!-- .entry-header --> </header><!-- .entry-header -->
<div class="entry-content"> <div class="entry-content">
<?php the_chat(); ?> <?php the_post_format_chat(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->

View File

@ -10,7 +10,7 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-media"> <div class="entry-media">
<?php the_video(); ?> <?php the_post_format_video(); ?>
</div><!-- .entry-media --> </div><!-- .entry-media -->
<header class="entry-header"> <header class="entry-header">

View File

@ -440,7 +440,7 @@ endif;
* @return string URL * @return string URL
*/ */
function twentythirteen_get_link_url() { function twentythirteen_get_link_url() {
$has_url = get_the_url(); $has_url = get_the_post_format_url();
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
} }

View File

@ -2031,7 +2031,7 @@ wp_embed_register_handler( 'wp_video_embed', '#https?://.+?\.(' . join( '|', wp_
* @param WP_Post $post Optional. Used instead of global $post when passed. * @param WP_Post $post Optional. Used instead of global $post when passed.
* @return string * @return string
*/ */
function get_the_media( $type, &$post = null ) { function get_the_post_format_media( $type, &$post = null ) {
global $wp_embed; global $wp_embed;
if ( empty( $post ) ) if ( empty( $post ) )
@ -2118,8 +2118,8 @@ function get_the_media( $type, &$post = null ) {
* @since 3.6.0 * @since 3.6.0
* *
*/ */
function the_video() { function the_post_format_video() {
echo get_the_media( 'video' ); echo get_the_post_format_media( 'video' );
} }
/** /**
* Output the first audio in the current (@global) post's content * Output the first audio in the current (@global) post's content
@ -2127,8 +2127,8 @@ function the_video() {
* @since 3.6.0 * @since 3.6.0
* *
*/ */
function the_audio() { function the_post_format_audio() {
echo get_the_media( 'audio' ); echo get_the_post_format_media( 'audio' );
} }
/** /**
@ -2360,7 +2360,7 @@ function get_post_gallery_images( $post_id = 0 ) {
* @param string $attached_size If an attached image is found, the size to display it. * @param string $attached_size If an attached image is found, the size to display it.
* @param WP_Post $post Optional. Used instead of global $post when passed. * @param WP_Post $post Optional. Used instead of global $post when passed.
*/ */
function get_the_image( $attached_size = 'full', &$post = null ) { function get_the_post_format_image( $attached_size = 'full', &$post = null ) {
if ( empty( $post ) ) if ( empty( $post ) )
$post = get_post(); $post = get_post();
@ -2435,6 +2435,6 @@ function get_the_image( $attached_size = 'full', &$post = null ) {
* *
* @param string $attached_size If an attached image is found, the size to display it. * @param string $attached_size If an attached image is found, the size to display it.
*/ */
function the_image( $attached_size = 'full' ) { function the_post_format_image( $attached_size = 'full' ) {
echo get_the_image( $attached_size ); echo get_the_post_format_image( $attached_size );
} }

View File

@ -574,7 +574,7 @@ function get_content_chat( &$content, $remove = false ) {
* @param int $id Optional. Post ID * @param int $id Optional. Post ID
* @return array * @return array
*/ */
function get_the_chat( $id = 0 ) { function get_the_post_format_chat( $id = 0 ) {
$post = empty( $id ) ? clone get_post() : get_post( $id ); $post = empty( $id ) ? clone get_post() : get_post( $id );
if ( empty( $post ) ) if ( empty( $post ) )
return array(); return array();
@ -592,13 +592,13 @@ function get_the_chat( $id = 0 ) {
* *
* @since 3.6.0 * @since 3.6.0
* *
* @uses get_the_chat() * @uses get_the_post_format_chat()
* *
* @print HTML * @print HTML
*/ */
function the_chat() { function the_post_format_chat() {
$output = '<dl class="chat">'; $output = '<dl class="chat">';
$stanzas = get_the_chat(); $stanzas = get_the_post_format_chat();
foreach ( $stanzas as $stanza ) { foreach ( $stanzas as $stanza ) {
foreach ( $stanza as $row ) { foreach ( $stanza as $row ) {
@ -673,7 +673,7 @@ function get_content_url( &$content, $remove = false ) {
* @param int $id Optional. Post ID. * @param int $id Optional. Post ID.
* @return string A URL, if found. * @return string A URL, if found.
*/ */
function get_the_url( $id = 0 ) { function get_the_post_format_url( $id = 0 ) {
$post = empty( $id ) ? get_post() : get_post( $id ); $post = empty( $id ) ? get_post() : get_post( $id );
if ( empty( $post ) ) if ( empty( $post ) )
return ''; return '';
@ -681,11 +681,11 @@ function get_the_url( $id = 0 ) {
if ( in_array( get_post_format( $post->ID ), array( 'link', 'quote' ) ) ) { if ( in_array( get_post_format( $post->ID ), array( 'link', 'quote' ) ) ) {
$meta = get_post_format_meta( $post->ID ); $meta = get_post_format_meta( $post->ID );
if ( ! empty( $meta['url'] ) ) if ( ! empty( $meta['url'] ) )
return apply_filters( 'get_the_url', esc_url_raw( $meta['url'] ), $post ); return apply_filters( 'get_the_post_format_url', esc_url_raw( $meta['url'] ), $post );
} }
if ( ! empty( $post->post_content ) ) if ( ! empty( $post->post_content ) )
return apply_filters( 'get_the_url', get_content_url( $post->post_content ), $post ); return apply_filters( 'get_the_post_format_url', get_content_url( $post->post_content ), $post );
} }
/** /**
@ -694,8 +694,8 @@ function get_the_url( $id = 0 ) {
* @since 3.6.0 * @since 3.6.0
*. *.
*/ */
function the_url() { function the_post_format_url() {
echo esc_url( get_the_url() ); echo esc_url( get_the_post_format_url() );
} }
/** /**

View File

@ -3697,17 +3697,17 @@ function setup_postdata($post) {
if ( $format && in_array( $format, array( 'image', 'audio', 'video' ) ) ) { if ( $format && in_array( $format, array( 'image', 'audio', 'video' ) ) ) {
switch ( $format ) { switch ( $format ) {
case 'image': case 'image':
get_the_image( 'full', $post ); get_the_post_format_image( 'full', $post );
if ( isset( $post->split_content ) ) if ( isset( $post->split_content ) )
$split_content = $post->split_content; $split_content = $post->split_content;
break; break;
case 'audio': case 'audio':
get_the_media( 'audio', $post ); get_the_post_format_media( 'audio', $post );
if ( isset( $post->split_content ) ) if ( isset( $post->split_content ) )
$split_content = $post->split_content; $split_content = $post->split_content;
break; break;
case 'video': case 'video':
get_the_media( 'video', $post ); get_the_post_format_media( 'video', $post );
if ( isset( $post->split_content ) ) if ( isset( $post->split_content ) )
$split_content = $post->split_content; $split_content = $post->split_content;
break; break;