Skip to content

Instantly share code, notes, and snippets.

@samuelsimoes
Created May 11, 2012 19:12
Show Gist options
  • Save samuelsimoes/2661820 to your computer and use it in GitHub Desktop.
Save samuelsimoes/2661820 to your computer and use it in GitHub Desktop.
Gerando LI com as imagens que estão anexadas ao post no Wordpress
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1
);
$imagens_post = get_posts($args);
if ($imagens_post) {
foreach ($imagens_post as $attachment) {
$url_imagem = wp_get_attachment_image_src($attachment->ID, 'full');
?>
<li>
<img src="<?php echo redimensionar_imagem($url_imagem[0], 221, 119); ?>" width="221" height="119"/>
<a href="<?php echo $url_mapa[0]; ?>" rel="lightbox" class="ampliar">Ampliar</a>
</li>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment