C
codigoadicto
Beta
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Este código muestra como obtener el Thumbnail de un post o varios post como en este caso, siempre y cuando el post cuente con alguna imagen.
Otro tipos de formatos que soporta la función the_post_thumbnail()
Quien quiera documentarse mas, puede hacer Function_Reference/the_post_thumbnail. Puedes pasar por mi blog y ver mas fragmentos de códigos, saludos.
PHP:
//obtengo primero los post en este caso todos
<?php query_posts( 'posts_per_page=-1' ); ?>
//el loop
<?php while (have_posts()) : the_post(); ?>
//obteniendo el thumbnail del post pasandole una dimension especifica
<?php the_post_thumbnail( array(100,100) ); ?>
//obteniendo el enlace permanente y el titulo
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
Otro tipos de formatos que soporta la función the_post_thumbnail()
PHP:
the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)
the_post_thumbnail('full'); // Full resolution (original size uploaded)
Quien quiera documentarse mas, puede hacer Function_Reference/the_post_thumbnail. Puedes pasar por mi blog y ver mas fragmentos de códigos, saludos.