Created
October 21, 2015 19:41
-
-
Save eliasfaical/5302161ff6710f70e652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$loop = new WP_Query( | |
array( | |
'post_type' => 'evento', | |
'ignore_sticky_posts' => 1, | |
'posts_per_page' => 2, | |
'paged' => $paged | |
) | |
); | |
if ( $loop->have_posts() ) : | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
$geleria_fotos = get_post_meta( $post->ID, 'geleria_fotos', true ); | |
foreach ( explode( ',', $geleria_fotos ) as $image_id ) { | |
$image_attributes_thumb = wp_get_attachment_image_src( $image_id, 'thumb-evento' ); | |
$image_attributes_full = wp_get_attachment_image_src( $image_id, 'full' ); | |
if( $image_attributes_thumb ) { | |
echo '<div class="item-footer">'; | |
echo '<a href="' . $image_attributes_full[0] . '" data-imagelightbox="f" title="Eventos Ajustes">'; | |
echo '<img class="img-responsive" alt="Eventos Ajustes" src="' . $image_attributes_thumb[0] . '" width="' . $image_attributes_thumb[1] . '" height="' . $image_attributes_thumb[2] . '">'; | |
echo '</a>'; | |
echo '</div>'; | |
} | |
} | |
endwhile; | |
else: | |
echo '<div class="alert alert-danger">Não há fotos cadastradas.</div>'; | |
endif; | |
wp_reset_postdata(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment