Set size of WordPress thumbnail post

I create function to get post thumbnail by category ID. this is the code:

<div class="row text-center">
    <?php
        foreach ( $wp_query->posts as $single_post) 
        {
            $single_post_ID = $single_post->ID;
            $url = wp_get_attachment_url( get_post_thumbnail_id($single_post_ID, 'medium') );
    ?>
    <div class="col-md-3 col-sm-6 hero-feature">
        <div class="thumbnail">
         <img src="<?php echo $url ?>" />
            <div class="caption">
                <h2><?php echo get_the_title( $single_post_ID ); ?></h2>
                <p>
                <a href="#" class="btn btn-primary">Commander</a> 
                <a href="#" class="btn btn-default">Plus Info</a>
                </p>
            </div>
        </div>
    </div>
    <?php } ?>
</div>

I want set the size of the thumb to 800px by 500px with wordpress functions.
Thanks

Leave a Comment