How do I get only the post image link in worpdress to put in the bootstrap card element?
<?php
$arti_query = new WP_Query(array('category_name' => 'artigos'));
if ( $arti_query->have_posts() ) {
while ( $arti_query->have_posts() ) {
$url = get_image();
$arti_query->the_post();
echo '<a href="#" class="card">';
echo '<img class="card-img-top" src="'.$url.'">';
echo '<div class="card-body">';
echo '<h5 class="card-title">';
echo the_title();
echo '</h5>';
$content = get_the_content();
$content = preg_replace( '/<img[^>]+./', '', $content );
$content = preg_replace( '/<p[^>]+./', '', $content);
echo '<p class="card-text">'.$content.'</p>';
echo '</div>';
echo '<div class="card-footer">';
echo '<small class="text-muted">';
echo get_the_date();
echo '</small>';
echo '</div>';
echo '</a>';
}
}
?>