|
@@ -413,3 +413,28 @@ if (!function_exists("post_badge")) {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+if (!function_exists("post_images")) {
|
|
|
|
+
|
|
|
|
+ function post_images($postid) {
|
|
|
|
+ global $wpdb;
|
|
|
|
+ if (isset($postid)) {
|
|
|
|
+ $images = array();
|
|
|
|
+ $post_image_attachments = @$wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content FROM $wpdb->posts WHERE post_parent = '$postid' AND post_type = 'attachment' AND post_mime_type LIKE '%image%' ORDER BY menu_order ASC");
|
|
|
|
+
|
|
|
|
+ foreach ($post_image_attachments as $attachment) {
|
|
|
|
+ $url = get_attachment_link($attachment->ID);
|
|
|
|
+ $id = $attachment->ID;
|
|
|
|
+ $img_title = apply_filters('the_title', $attachment->post_title);
|
|
|
|
+ $thumbnail = wp_get_attachment_image_src($attachment->ID, 'thumbnail');
|
|
|
|
+ $medium = wp_get_attachment_image_src($attachment->ID, 'medium');
|
|
|
|
+ $large = wp_get_attachment_image_src($attachment->ID, 'large');
|
|
|
|
+ $xlarge = wp_get_attachment_image_src($attachment->ID, 'xlarge');
|
|
|
|
+ $full = wp_get_attachment_image_src($attachment->ID, 'full');
|
|
|
|
+ $image = array('title' => $img_title, 'id' => $id, 'url' => $url, 'thumbnail' => $thumbnail, 'medium' => $medium, 'large' => $large, 'xlarge' => $xlarge, 'full' => $full, 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content);
|
|
|
|
+
|
|
|
|
+ array_push($images, $image);
|
|
|
|
+ }
|
|
|
|
+ return $images;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|