The easiest method is to use the same image size for all your images that you want o use in slider.
Another method is to implement cropping. The basic example would be like this:
1. Create a Child Theme.
2. Add this to Child Theme functions.php
file to register a new thumbnail size. You can use any size you want.
add_image_size( 'dazzling-featured-slider', 1920, 600, true );
3. Now add this code inside Child Themefunctions.php
. It will change slider output to use previously generated featured images.
if ( ! function_exists( 'dazzling_featured_slider' ) ) :
/**
* Featured image slider
*/
function dazzling_featured_slider() {
if ( is_front_page() && of_get_option('dazzling_slider_checkbox') == 1 ) {
echo '<div class="flexslider">';
echo '<ul class="slides">';
$count = of_get_option('dazzling_slide_number');
$slidecat = of_get_option('dazzling_slide_categories');
if ( $count && $slidecat ) {
$query = new WP_Query( array( 'cat' => $slidecat, 'posts_per_page' => $count ) );
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
echo '<li>';
if ( has_post_thumbnail() ) { // Check if the post has a featured image assigned to it.
the_post_thumbnail( 'dazzling-featured-slider' );
}
echo '<div class="flex-caption">';
echo '<a href="'. get_permalink() .'">';
if ( get_the_title() != '' ) echo '<h2 class="entry-title">'. get_the_title().'</h2>';
if ( get_the_excerpt() != '' ) echo '<div class="excerpt">' . get_the_excerpt() .'</div>';
echo '</a>';
echo '</div>';
endwhile;
endif;
} else {
echo "Slider is not properly configured";
}
echo '</li>';
echo '</ul>';
echo ' </div>';
}
}
endif;
4. These changes are not applied instantly and you need to run Regenerate thumbnail plugin to generate new images. All images that you will upload now will have newly generate image size but old images you need to regenerate manually using plugin mentioned above.