get_media_items [ WordPress Function ]
get_media_items ( $post_id, $errors )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Retrieve HTML for media items of post gallery.
The HTML markup retrieved will be created for the progress of SWF Upload component. Will also create link for showing and hiding the form to modify the image attachment.
Source
<?php
function get_media_items( $post_id, $errors ) {
$attachments = array();
if ( $post_id ) {
$post = get_post($post_id);
if ( $post && $post->post_type == 'attachment' )
$attachments = array($post->ID => $post);
else
$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
} else {
if ( is_array($GLOBALS['wp_the_query']->posts) )
foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
$attachments[$attachment->ID] = $attachment;
}
$output = '';
foreach ( (array) $attachments as $id => $attachment ) {
if ( $attachment->post_status == 'trash' )
continue;
if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
}
return $output;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- plugin development - How do you filter get_media_items by mime ...
Mar 25, 2011 ... The list of media items shows up fine but I can only get it to show just the audio files when I don't pass a post ID into the get_media_items() ...
wordpress.stackexchange.com - Function Reference/get media items « WordPress Codex
Description. Retrieve HTML for media items of post gallery. The HTML markup retrieved will be created for the progress of SWF Upload component. Will also ...
codex.wordpress.org - get_media_items | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_media_items( $post_id, $errors ) {}. Retrieve HTML for media items of post gallery. The HTML markup retrieved will be created for ...
hitchhackerguide.com - PHPXRef 0.7 : WordPress : Function Reference: get_media_items()
Function and Method Cross Reference. get_media_items(). Defined at: /wp- admin/includes/media.php -> line 997. Referenced 3 times: ...
phpxref.ftwr.co.uk