Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function gc_get_images($size = 'large', $limit = '0', $offset = '0') {
- global $post;
- $images = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
- if ($images) {
- $num_of_images = count($images);
- if ($offset > 0) : $start = $offset--; else : $start = 0; endif;
- if ($limit > 0) : $stop = $limit+$start; else : $stop = $num_of_images; endif;
- $i = 0;
- foreach ($images as $image) {
- if ($start <= $i and $i < $stop) {
- $img_title = $image->post_title; // title.
- $img_description = $image->post_content; // description.
- $img_caption = $image->post_excerpt; // caption.
- $img_url = wp_get_attachment_url($image->ID); // url of the full size image.
- $preview_array = image_downsize( $image->ID, $size );
- $img_preview = $preview_array[0]; // thumbnail or medium image to use for preview.
- ?>
- <li><img src="<?php echo $img_preview; ?>" alt="<?php echo $img_caption; ?>" /><p class="caption"><?php echo $img_caption; ?></p></li>
- <?
- }
- $i++;
- }
- }
- }
- ?>
- <!-- HTML -->
- <div class="slider">
- <ul class="slides">
- <?php gc_get_images('large','0','0'); ?>
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement