Brian
Cómo establecer the_post_thumbnail
para que no use una matriz para su tamaño, sino que se pueda configurar con un ancho del 100% y una altura automática:
<?php $ht_featured_img = get_option('ht_featured_img');
if ($ht_featured_img == "true") { ?>
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { /* if post has a thumbnail */ ?>
<div class="post-image">
<?php the_post_thumbnail( array(1215,9999) ); ?>
</div><!--post-image-->
<?php } ?>
<?php } ?>
<?php $ht_featured_img = get_option('ht_featured_img'); if ($ht_featured_img == "true") { ?>
<?php if ( ( function_exists('has_post_thumbnail') ) && ( has_post_thumbnail() ) ) {
$post_thumbnail_id = get_post_thumbnail_id();
$post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
?>
<div class="post-image">
<img title="image title" alt="thumb image" class="wp-post-image" src="https://stackoverflow.com/questions/18906199/<?php echo $post_thumbnail_url; ?>" style="width:100%; height:auto;">
</div>
<?php } ?>
<?php } ?>
-
¡Fantástico, eso hizo el trabajo! ¡¡Gracias!! Para title=”image title” terminé usando: title=”” en caso de que alguien más necesite lo mismo en el futuro.
– Brian
20 de septiembre de 2013 a las 7:54
<? if( has_post_thumbnail( $post_id ) ): ?>
<div class="post-image">
<img title="image title" alt="thumb image" class="wp-post-image"
src="https://stackoverflow.com/questions/18906199/<?=wp_get_attachment_url( get_post_thumbnail_id() ); ?>" style="width:100%; height:auto;">
</div>
<? endif; ?>
-
Agregue más que solo código, explique lo que está haciendo, cómo funciona y por qué es una solución.
– Jojodmo
3 de febrero de 2014 a las 1:26
También podrías simplemente usar
<img src="https://stackoverflow.com/questions/18906199/<?php echo get_the_post_thumbnail_url (); ?>" style="width:100%; height:auto;">
¿Ha sido útil esta solución?
Tu feedback nos ayuda a saber si la solución es correcta y está funcionando. De esta manera podemos revisar y corregir el contenido.