Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* No functions.php */
- // Função para galeria em lista não ordenada - uso em Slides - neste exemplo: PikaChoose
- function slide_image_gallery() {
- global $post;
- $limitImages = 5; /* número de imagens no slide */
- $args = array(
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'numberposts' => $limitImages + 1,
- 'orderby' => 'menu_order',
- 'order' => 'ASC',
- 'post_parent' => $post->ID
- );
- $images = get_posts($args);
- if($images) :
- $count = 1;
- foreach($images as $image) {
- $full_image_url = wp_get_attachment_image_src( $image->ID, 'full'); /* link para a imagem grande - útil para o fancybox */
- $imageCaption = $image->post_excerpt; /* legenda da imagem do post para ser usada como a Caption do Pikachoose */
- if($count <= $limitImages) :
- echo '<li><a href="' . $full_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
- echo wp_get_attachment_image($image->ID, 'gallery-thumbnail');
- echo '</a>';
- echo '<span>' .$imageCaption. '</span>';
- echo '</li>';
- endif;
- $count++;
- }
- endif;
- }
- ?>
- /* No loop, depois de <php the_content(); ?> */
- <div id="pikachoose">
- <ul id="pikame">
- <?php slide_image_gallery(); ?>
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment