So, I want to display titles and excerpt in line with images? How can I do that?
<div id="treia_box" style="height:350px; width:350px;">
<?php
add_filter('excerpt_length', 'new_excerpt_length');
global $post;
$args = array( 'numberposts' => 3, 'category' => 29 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<h2><a href="<?php the_permalink(); ?>"<?php the_title('<h7>', '<h7>'); ?></a></h2>
<?php $size = array(75,75);
echo get_the_post_thumbnail($post_id, $size)?>
<h6><?php the_excerpt(); ?></h6>
<?php endforeach; ?>
</div>
get_the_post_thumbnail($post_id, $size) would be correct , but :
1 - you need to specify $size , e.g. : "large" , "thumbnail" "my_custom_size"
get_the_post_thumbnail($id, 'thumbnail'); // Thumbnail
get_the_post_thumbnail($id, 'medium'); // Medium resolution
get_the_post_thumbnail($id, 'large'); // Large resolution
get_the_post_thumbnail($id, array(100,100) ); // Other resolutions
2 - It will work only if the user (you) define a post thumbnail (featured - image when creating a post)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With