Changeset 23984 for trunk/wp-includes/media.php
- Timestamp:
- 04/14/2013 01:11:44 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/media.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r23969 r23984 1846 1846 * @param boolean $html Whether to return HTML or URLs 1847 1847 * @param boolean $remove Whether to remove the found URL from the passed content. 1848 * @param int $limit Optional. The number of medias to return 1848 1849 * @return array A list of parsed shortcodes or extracted srcs 1849 1850 */ 1850 function get_content_media( $type, &$content, $html = true, $remove = false ) {1851 function get_content_media( $type, &$content, $html = true, $remove = false, $limit = 0 ) { 1851 1852 $items = array(); 1852 1853 $matches = array(); … … 1860 1861 1861 1862 $items[] = do_shortcode_tag( $shortcode ); 1863 if ( $limit > 0 && count( $items ) >= $limit ) 1864 break; 1862 1865 } 1863 1866 } … … 2044 2047 * @param string $type Required. 'audio' or 'video' 2045 2048 * @param WP_Post $post Optional. Used instead of global $post when passed. 2049 * @param int $limit Optional. The number of medias to remove if content is scanned. 2046 2050 * @return string 2047 2051 */ 2048 function get_the_post_format_media( $type, &$post = null ) {2052 function get_the_post_format_media( $type, &$post = null, $limit = 0 ) { 2049 2053 global $wp_embed; 2050 2054 … … 2091 2095 $content = $post->post_content; 2092 2096 2093 $htmls = get_content_media( $type, $content, true, true );2097 $htmls = get_content_media( $type, $content, true, true, $limit ); 2094 2098 if ( ! empty( $htmls ) ) { 2095 2099 $html = reset( $htmls ); … … 2134 2138 */ 2135 2139 function the_post_format_video() { 2136 echo get_the_post_format_media( 'video' ); 2140 $null = null; 2141 echo get_the_post_format_media( 'video', $null, 1 ); 2137 2142 } 2138 2143 /** … … 2143 2148 */ 2144 2149 function the_post_format_audio() { 2145 echo get_the_post_format_media( 'audio' ); 2150 $null = null; 2151 echo get_the_post_format_media( 'audio', $null, 1 ); 2146 2152 } 2147 2153
Note: See TracChangeset
for help on using the changeset viewer.