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:
parent
2a38966a97
commit
15dc5a3718
|
@ -465,7 +465,7 @@ endif; // twentyeleven_content_nav
|
|||
* @return string
|
||||
*/
|
||||
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 )
|
||||
$has_url = twentyeleven_url_grabber();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<div class="entry-media">
|
||||
<div class="audio-content">
|
||||
<?php the_audio(); ?>
|
||||
<?php the_post_format_audio(); ?>
|
||||
</div><!-- .audio-content -->
|
||||
</div><!-- .entry-media -->
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</header><!-- .entry-header -->
|
||||
|
||||
<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>' ) ); ?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<div class="entry-media">
|
||||
<?php the_video(); ?>
|
||||
<?php the_post_format_video(); ?>
|
||||
</div><!-- .entry-media -->
|
||||
|
||||
<header class="entry-header">
|
||||
|
|
|
@ -440,7 +440,7 @@ endif;
|
|||
* @return string 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() );
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
* @return string
|
||||
*/
|
||||
function get_the_media( $type, &$post = null ) {
|
||||
function get_the_post_format_media( $type, &$post = null ) {
|
||||
global $wp_embed;
|
||||
|
||||
if ( empty( $post ) )
|
||||
|
@ -2118,8 +2118,8 @@ function get_the_media( $type, &$post = null ) {
|
|||
* @since 3.6.0
|
||||
*
|
||||
*/
|
||||
function the_video() {
|
||||
echo get_the_media( 'video' );
|
||||
function the_post_format_video() {
|
||||
echo get_the_post_format_media( 'video' );
|
||||
}
|
||||
/**
|
||||
* Output the first audio in the current (@global) post's content
|
||||
|
@ -2127,8 +2127,8 @@ function the_video() {
|
|||
* @since 3.6.0
|
||||
*
|
||||
*/
|
||||
function the_audio() {
|
||||
echo get_the_media( 'audio' );
|
||||
function the_post_format_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 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 ) )
|
||||
$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.
|
||||
*/
|
||||
function the_image( $attached_size = 'full' ) {
|
||||
echo get_the_image( $attached_size );
|
||||
function the_post_format_image( $attached_size = 'full' ) {
|
||||
echo get_the_post_format_image( $attached_size );
|
||||
}
|
|
@ -574,7 +574,7 @@ function get_content_chat( &$content, $remove = false ) {
|
|||
* @param int $id Optional. Post ID
|
||||
* @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 );
|
||||
if ( empty( $post ) )
|
||||
return array();
|
||||
|
@ -592,13 +592,13 @@ function get_the_chat( $id = 0 ) {
|
|||
*
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @uses get_the_chat()
|
||||
* @uses get_the_post_format_chat()
|
||||
*
|
||||
* @print HTML
|
||||
*/
|
||||
function the_chat() {
|
||||
function the_post_format_chat() {
|
||||
$output = '<dl class="chat">';
|
||||
$stanzas = get_the_chat();
|
||||
$stanzas = get_the_post_format_chat();
|
||||
|
||||
foreach ( $stanzas as $stanza ) {
|
||||
foreach ( $stanza as $row ) {
|
||||
|
@ -673,7 +673,7 @@ function get_content_url( &$content, $remove = false ) {
|
|||
* @param int $id Optional. Post ID.
|
||||
* @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 );
|
||||
if ( empty( $post ) )
|
||||
return '';
|
||||
|
@ -681,11 +681,11 @@ function get_the_url( $id = 0 ) {
|
|||
if ( in_array( get_post_format( $post->ID ), array( 'link', 'quote' ) ) ) {
|
||||
$meta = get_post_format_meta( $post->ID );
|
||||
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 ) )
|
||||
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
|
||||
*.
|
||||
*/
|
||||
function the_url() {
|
||||
echo esc_url( get_the_url() );
|
||||
function the_post_format_url() {
|
||||
echo esc_url( get_the_post_format_url() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3697,17 +3697,17 @@ function setup_postdata($post) {
|
|||
if ( $format && in_array( $format, array( 'image', 'audio', 'video' ) ) ) {
|
||||
switch ( $format ) {
|
||||
case 'image':
|
||||
get_the_image( 'full', $post );
|
||||
get_the_post_format_image( 'full', $post );
|
||||
if ( isset( $post->split_content ) )
|
||||
$split_content = $post->split_content;
|
||||
break;
|
||||
case 'audio':
|
||||
get_the_media( 'audio', $post );
|
||||
get_the_post_format_media( 'audio', $post );
|
||||
if ( isset( $post->split_content ) )
|
||||
$split_content = $post->split_content;
|
||||
break;
|
||||
case 'video':
|
||||
get_the_media( 'video', $post );
|
||||
get_the_post_format_media( 'video', $post );
|
||||
if ( isset( $post->split_content ) )
|
||||
$split_content = $post->split_content;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue