Não exibir imagem quando não tiver imagem
-
Em meu theme quando um post não tem imagem, mostra uma imagem padrão (/images/image-pending.gif). Eu gostaria que, quando não tivesse imagem, não aparecesse a imagem padrão. Alguém pode me ajudar? O código referente a imagem, no functions.php reproduzo abaixo:
# Get image attachment (sizes: thumbnail, medium, full) function get_thumbnail($postid=0, $size='full') { if ($postid<1) $postid = get_the_ID(); $thumb = get_post_meta($postid, "thumb", TRUE); // Declare the custom field for the image if ($thumb != null or $thumb != '') { echo $thumb; } elseif ($images = get_children(array( 'post_parent' => $postid, 'post_type' => 'attachment', 'numberposts' => '1', 'post_mime_type' => 'image', ))) foreach($images as $image) { $thumbnail=wp_get_attachment_image_src($image->ID, $size); ?> <?php echo $thumbnail[0]; ?> <?php } else { echo get_bloginfo ( 'stylesheet_directory' ); echo '/images/image-pending.gif'; } }
Visualizando 2 respostas - 1 até 2 (de um total de 2)
Visualizando 2 respostas - 1 até 2 (de um total de 2)
- O tópico ‘Não exibir imagem quando não tiver imagem’ está fechado para novas respostas.