Ver Mensaje Individual
  #9 (permalink)  
Antiguo 17/01/2013, 09:25
Avatar de rogertm
rogertm
Mod->Cuba
 
Fecha de Ingreso: julio-2005
Ubicación: /home/Cuba/Habana/rogertm/
Mensajes: 2.922
Antigüedad: 18 años, 8 meses
Puntos: 638
Respuesta: En volcado de posts por cat muestre la 1a foto de cada uno

En Twentyten viene un código que funciona perfectamente, y no es tan complicado...

Código PHP:
Ver original
  1. <?php
  2. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  3. if ( $images ) :
  4.     $total_images = count( $images );
  5.     $image = array_shift( $images );
  6.     $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  7. ?>
  8.     <div class="gallery-thumb">
  9.         <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  10.     </div><!-- .gallery-thumb -->
  11.     <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyten' ),
  12.             'href="' . get_permalink() . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
  13.             number_format_i18n( $total_images )
  14.         ); ?></em></p>
  15. <?php endif; ?>

Eso lo pones en category.php... Saludos.

PD: Por casualidad Thesis es de pago???
__________________
Friki y Blogger por Cuenta Propia:213
Twenty'em: Theming is Prose