Use wordpress’s in-built “featured image” (can be set on post’s editing page in wordpress admin).
On the page displaying the excerpts:
<div id="excerpts">
<?php
$args = array( 'numberposts' => 3, 'category'=> '1,3,5' ); }
// set number of excepts to show
// and optionally restrict to certain categories
$posts = get_posts($args);
foreach($posts as $post) : setup_postdata($post);
?>
<div class="single-excerpt">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php if ( has_post_thumbnail()) the_post_thumbnail('excerpt-thumb'); ?>
<!-- displays thumbnail if it exists -->
<p><?php the_excerpt();?></p>
</div><!-- single-excerpt -->
<?php endforeach; ?>
</div><!-- excerpts -->
functions.php
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'excerpt-thumb', 0, 100, false );
// define excerpt-thumb size here
// in the example: 100px wide, height adjusts automatically, no cropping
}
function new_excerpt_length($length) {
return 42;
// define length of excerpt in number of words
}
add_filter('excerpt_length', 'new_excerpt_length');
How to get Title, Image and excerpt of posts of a specific category WordPress
<?php
query_posts( array('posts_per_page'=>5, 'category_name'=>'Cooling Towers') );
while ( have_posts() ) : the_post();
?>
<h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php if ( has_post_thumbnail() ): // check for the featured image ?>
<a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>" class="opacity"><?php the_post_thumbnail(); ?></a> <!--echo the featured image-->
<?php
endif;
the_excerpt(); // echo the excerpt
endwhile;
wp_reset_query(); // resets main query
?>
limit excerpt
https://smallenvelop.com/limit-post-excerpt-length-in-wordpress/