Changeset 23826 for trunk/wp-content/themes/twentyten/functions.php
- Timestamp:
- 03/27/2013 08:37:34 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-content/themes/twentyten/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyten/functions.php
r23778 r23826 515 515 } 516 516 endif; 517 518 /** 519 * Retrieves the IDs for images in a gallery. 520 * 521 * @uses get_post_galleries() first, if available. Falls back to shortcode parsing, 522 * then as last option uses a get_posts() call. 523 * 524 * @since Twenty Ten 1.6. 525 * 526 * @return array List of image IDs from the post gallery. 527 */ 528 function twentyten_get_gallery_images() { 529 $images = array(); 530 531 if ( function_exists( 'get_post_gallery_images' ) ) { 532 $galleries = get_post_galleries(); 533 if ( isset( $galleries[0]['ids'] ) ) 534 $images = explode( ',', $galleries[0]['ids'] ); 535 } else { 536 $pattern = get_shortcode_regex(); 537 preg_match( "/$pattern/s", get_the_content(), $match ); 538 $atts = shortcode_parse_atts( $match[3] ); 539 if ( isset( $atts['ids'] ) ) 540 $images = explode( ',', $atts['ids'] ); 541 } 542 543 if ( ! $images ) { 544 $images = get_posts( array( 545 'fields' => 'ids', 546 'numberposts' => 999, 547 'order' => 'ASC', 548 'orderby' => 'menu_order', 549 'post_mime_type' => 'image', 550 'post_parent' => get_the_ID(), 551 'post_type' => 'attachment', 552 ) ); 553 } 554 555 return $images; 556 }
Note: See TracChangeset
for help on using the changeset viewer.