diff --git wp-admin/js/post-formats.js wp-admin/js/post-formats.js
index 33f2e96..10f0f1d 100644
|
|
|
window.wp = window.wp || {}; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $(function(){ |
| 83 | | |
| 84 | 83 | $('.post-format-change a').click(function() { |
| 85 | 84 | $('.post-formats-fields, .post-format-change').slideUp(); |
| 86 | 85 | $('.post-format-options').slideDown(); |
diff --git wp-content/themes/twentythirteen/content-gallery.php wp-content/themes/twentythirteen/content-gallery.php
index 6ee2b3d..e357980 100644
|
|
|
|
| 24 | 24 | <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?> |
| 25 | 25 | <?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>' ) ); ?> |
| 26 | 26 | <?php else : ?> |
| 27 | | <?php the_content(); ?> |
| | 27 | <?php the_post_format_gallery(); ?> |
| 28 | 28 | <?php endif; // is_single() ?> |
| 29 | 29 | </div><!-- .entry-content --> |
| 30 | 30 | |
diff --git wp-includes/media.php wp-includes/media.php
index 09e0630..9528874 100644
|
|
|
function get_content_image( &$content, $html = true, $remove = false ) { |
| 2293 | 2293 | * @since 3.6.0 |
| 2294 | 2294 | * |
| 2295 | 2295 | * @param string $content A string which might contain image data. |
| | 2296 | * @param boolean $html Whether to return HTML or data |
| 2296 | 2297 | * @param boolean $remove Optional. Whether to remove the found data from the passed content. |
| 2297 | 2298 | * @param int $limit Optional. The number of galleries to return |
| 2298 | 2299 | * @return array A list of galleries, which in turn are a list of their srcs in order |
| 2299 | 2300 | */ |
| 2300 | | function get_content_galleries( &$content, $remove = false, $limit = 0 ) { |
| | 2301 | function get_content_galleries( &$content, $html = true, $remove = false, $limit = 0 ) { |
| 2301 | 2302 | $src = ''; |
| 2302 | 2303 | $galleries = array(); |
| 2303 | 2304 | $matches = array(); |
| … |
… |
function get_content_galleries( &$content, $remove = false, $limit = 0 ) { |
| 2312 | 2313 | |
| 2313 | 2314 | $data = shortcode_parse_atts( $shortcode[3] ); |
| 2314 | 2315 | $gallery = do_shortcode_tag( $shortcode ); |
| 2315 | | preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER ); |
| 2316 | | if ( ! empty( $src ) ) { |
| 2317 | | foreach ( $src as $s ) |
| 2318 | | $srcs[] = $s[1]; |
| | 2316 | if ( $html ) { |
| | 2317 | $galleries[] = $gallery; |
| | 2318 | } else { |
| | 2319 | preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER ); |
| | 2320 | if ( ! empty( $src ) ) { |
| | 2321 | foreach ( $src as $s ) |
| | 2322 | $srcs[] = $s[1]; |
| | 2323 | } |
| | 2324 | |
| | 2325 | $data['src'] = array_values( array_unique( $srcs ) ); |
| | 2326 | $galleries[] = $data; |
| 2319 | 2327 | } |
| 2320 | 2328 | |
| 2321 | | $data['src'] = array_values( array_unique( $srcs ) ); |
| 2322 | | $galleries[] = $data; |
| 2323 | 2329 | if ( $limit > 0 && count( $galleries ) >= $limit ) |
| 2324 | 2330 | break; |
| 2325 | 2331 | } |
| … |
… |
function get_content_galleries( &$content, $remove = false, $limit = 0 ) { |
| 2335 | 2341 | * @since 3.6.0 |
| 2336 | 2342 | * |
| 2337 | 2343 | * @param int $post_id Optional. Post ID. |
| | 2344 | * @param boolean $html Whether to return HTML or data |
| 2338 | 2345 | * @return array A list of arrays, each containing gallery data and srcs parsed |
| 2339 | 2346 | * from the expanded shortcode |
| 2340 | 2347 | */ |
| 2341 | | function get_post_galleries( $post_id = 0 ) { |
| | 2348 | function get_post_galleries( $post_id = 0, $html = true ) { |
| 2342 | 2349 | $post = empty( $post_id ) ? clone get_post() : get_post( $post_id ); |
| 2343 | 2350 | if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) |
| 2344 | 2351 | return array(); |
| 2345 | 2352 | |
| 2346 | | return get_content_galleries( $post->post_content ); |
| | 2353 | return get_content_galleries( $post->post_content, $html ); |
| 2347 | 2354 | } |
| 2348 | 2355 | |
| 2349 | 2356 | /** |
| … |
… |
function get_post_galleries_images( $post_id = 0 ) { |
| 2360 | 2367 | if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) |
| 2361 | 2368 | return array(); |
| 2362 | 2369 | |
| 2363 | | $data = get_content_galleries( $post->post_content ); |
| | 2370 | $data = get_content_galleries( $post->post_content, false ); |
| 2364 | 2371 | return wp_list_pluck( $data, 'src' ); |
| 2365 | 2372 | } |
| 2366 | 2373 | |
| … |
… |
function get_post_galleries_images( $post_id = 0 ) { |
| 2370 | 2377 | * @since 3.6.0 |
| 2371 | 2378 | * |
| 2372 | 2379 | * @param int $post_id Optional. Post ID. |
| | 2380 | * @param boolean $html Whether to return HTML or data |
| 2373 | 2381 | * @return array Gallery data and srcs parsed from the expanded shortcode |
| 2374 | 2382 | */ |
| 2375 | | function get_post_gallery( $post_id = 0 ) { |
| | 2383 | function get_post_gallery( $post_id = 0, $html = true ) { |
| 2376 | 2384 | $post = empty( $post_id ) ? clone get_post() : get_post( $post_id ); |
| 2377 | 2385 | if ( empty( $post ) || ! has_shortcode( $post->post_content, 'gallery' ) ) |
| 2378 | 2386 | return array(); |
| 2379 | 2387 | |
| 2380 | | $data = get_content_galleries( $post->post_content, false, 1 ); |
| | 2388 | $data = get_content_galleries( $post->post_content, $html, false, 1 ); |
| 2381 | 2389 | return reset( $data ); |
| 2382 | 2390 | } |
| 2383 | 2391 | |
| 2384 | 2392 | /** |
| | 2393 | * Output the first gallery in the current (@global) $post |
| | 2394 | * |
| | 2395 | * @since 3.6.0 |
| | 2396 | */ |
| | 2397 | function the_post_format_gallery() { |
| | 2398 | echo get_post_gallery(); |
| | 2399 | } |
| | 2400 | |
| | 2401 | /** |
| 2385 | 2402 | * Check a post's content for galleries and return the image srcs for the first found gallery |
| 2386 | 2403 | * |
| 2387 | 2404 | * @since 3.6.0 |
| … |
… |
function get_post_gallery( $post_id = 0 ) { |
| 2390 | 2407 | * @return array A list of a gallery's image srcs in order |
| 2391 | 2408 | */ |
| 2392 | 2409 | function get_post_gallery_images( $post_id = 0 ) { |
| 2393 | | $gallery = get_post_gallery( $post_id ); |
| | 2410 | $gallery = get_post_gallery( $post_id, false ); |
| 2394 | 2411 | if ( empty( $gallery['src'] ) ) |
| 2395 | 2412 | return array(); |
| 2396 | 2413 | |