| | 884 | * Return the URL of the next adjacent image in a gallery or the URL of the parent post |
| | 885 | */ |
| | 886 | function get_next_image_url() { |
| | 887 | global $post; |
| | 888 | $post = get_post($post); |
| | 889 | $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); |
| | 890 | |
| | 891 | foreach ( $attachments as $k => $attachment ) |
| | 892 | if ( $attachment->ID == $post->ID ) |
| | 893 | break; |
| | 894 | |
| | 895 | $k = $k + 1; |
| | 896 | |
| | 897 | if ( isset($attachments[$k]) ) { |
| | 898 | return get_attachment_link($attachments[$k]->ID); |
| | 899 | } else { |
| | 900 | return get_permalink($post->post_parent); |
| | 901 | } |
| | 902 | } |
| | 903 | |
| | 904 | /** |