diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 804a34f6ac..ae2cc3b7c8 100644
a
|
b
|
function gallery_shortcode( $attr ) { |
2408 | 2408 | * @param string $output The gallery output. Default empty. |
2409 | 2409 | * @param array $attr Attributes of the gallery shortcode. |
2410 | 2410 | * @param int $instance Unique numeric ID of this gallery shortcode instance. |
| 2411 | * @param int $total_count Sets a maxiumum list of attachments to display. |
2411 | 2412 | */ |
2412 | 2413 | $output = apply_filters( 'post_gallery', '', $attr, $instance ); |
2413 | 2414 | |
… |
… |
function gallery_shortcode( $attr ) { |
2426 | 2427 | 'captiontag' => $html5 ? 'figcaption' : 'dd', |
2427 | 2428 | 'columns' => 3, |
2428 | 2429 | 'size' => 'thumbnail', |
| 2430 | 'total_count' => 0, |
2429 | 2431 | 'include' => '', |
2430 | 2432 | 'exclude' => '', |
2431 | 2433 | 'link' => '', |
… |
… |
function gallery_shortcode( $attr ) { |
2436 | 2438 | |
2437 | 2439 | $id = (int) $atts['id']; |
2438 | 2440 | |
| 2441 | $total_count = intval( $atts['count'] ); |
| 2442 | |
| 2443 | // Check total_count isset and less than 0 |
| 2444 | if( isset( $total_count ) && $total_count <= 0 ) { |
| 2445 | $total_count = -1; |
| 2446 | } |
| 2447 | |
| 2448 | // Check atts is not empty. |
2439 | 2449 | if ( ! empty( $atts['include'] ) ) { |
2440 | 2450 | $_attachments = get_posts( |
2441 | 2451 | array( |
… |
… |
function gallery_shortcode( $attr ) { |
2445 | 2455 | 'post_mime_type' => 'image', |
2446 | 2456 | 'order' => $atts['order'], |
2447 | 2457 | 'orderby' => $atts['orderby'], |
| 2458 | 'numberposts' => $total_count, |
2448 | 2459 | ) |
2449 | 2460 | ); |
2450 | 2461 | |
… |
… |
function gallery_shortcode( $attr ) { |
2462 | 2473 | 'post_mime_type' => 'image', |
2463 | 2474 | 'order' => $atts['order'], |
2464 | 2475 | 'orderby' => $atts['orderby'], |
| 2476 | 'numberposts' => $total_count, |
2465 | 2477 | ) |
2466 | 2478 | ); |
2467 | 2479 | } else { |
… |
… |
function gallery_shortcode( $attr ) { |
2473 | 2485 | 'post_mime_type' => 'image', |
2474 | 2486 | 'order' => $atts['order'], |
2475 | 2487 | 'orderby' => $atts['orderby'], |
| 2488 | 'numberposts' => $total_count, |
2476 | 2489 | ) |
2477 | 2490 | ); |
2478 | 2491 | } |