1451 | | * @param int|WP_Post $id Optional. Post ID or post object. |
1452 | | * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. |
1453 | | * @param bool $permalink Optional, default is false. Whether to add permalink to image. |
1454 | | * @param bool $icon Optional, default is false. Whether to include icon. |
1455 | | * @param string|bool $text Optional, default is false. If string, then will be link text. |
| 1450 | * @param array $args { |
| 1451 | * An array of arguments. Optional. |
| 1452 | * |
| 1453 | * @type int|WP_Post $ID Optional. Post ID or post object. |
| 1454 | * @type string $image_size Optional, default is 'thumbnail'. Size of image, either array or string. |
| 1455 | * @type bool $include_permalink_in_anchor Optional, default is false. Whether to add permalink to the anchor. |
| 1456 | * @type bool $display_media_icon Optional, default is false. Whether to include icon. |
| 1457 | * @type string|bool $link_content Optional, default is false. If string, then will be link text. |
| 1458 | * } |
1458 | | function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { |
1459 | | $id = intval( $id ); |
| 1461 | function wp_get_attachment_link( $args = array() ) { |
| 1462 | // Backward compatibility. Convert deprecated function parameters into an options hash. |
| 1463 | if ( ! is_array( $args ) || func_num_args() > 1 ) { |
| 1464 | _deprecated_argument( __FUNCTION__, '4.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.' ), __FUNCTION__, __FILE__ ) ); |
| 1465 | |
| 1466 | $old_parameters = array( 'ID', 'image_size', 'include_permalink_in_anchor', 'display_media_icon', 'link_content' ); |
| 1467 | $func_args = func_get_args(); |
| 1468 | $args = array_combine( array_slice( $old_parameters, 0, count( $func_args ) ), $func_args ); |
| 1469 | } |
| 1470 | $args = wp_parse_args( $args, array( |
| 1471 | 'ID' => 0, |
| 1472 | 'image_size' => 'thumbnail', |
| 1473 | 'include_permalink_in_anchor' => false, |
| 1474 | 'display_media_icon' => false, |
| 1475 | 'link_content' => false, |
| 1476 | ) ); |
| 1477 | |
| 1478 | $id = intval( $args['ID'] ); |
1483 | | * @param string $link_html The page link HTML output. |
1484 | | * @param int $id Post ID. |
1485 | | * @param string $size Image size. Default 'thumbnail'. |
1486 | | * @param bool $permalink Whether to add permalink to image. Default false. |
1487 | | * @param bool $icon Whether to include an icon. Default false. |
1488 | | * @param string|bool $text If string, will be link text. Default false. |
| 1501 | * @param string $link_html The page link HTML output. |
| 1502 | * @param int $id Post ID. |
| 1503 | * @param string $args['image_size'] Image size. Default 'thumbnail'. |
| 1504 | * @param bool $args['include_permalink_in_anchor'] Whether to add permalink in the anchor. Default false. |
| 1505 | * @param bool $args['display_media_icon'] Whether to include an icon. Default false. |
| 1506 | * @param string|bool $args['link_content'] Content of the anchor. Default false. |