Link images to post.
Hi all
I'm sure this is simple but I can't see how to do it.
I know how to add images to a post - Click in the post, Add Media, choose thumbnail.
This gives me an thumbnail in the post.
I think what I want to do is link thumbnails to the post so I can control where the thumbnails appear on the page.
I have a template like this.
<div class="content_div">
<?php
$car_args = array(
'post_type' => 'post',
'category_name' => 'car',
'order' => 'asc'
);
$cars = new WP_Query($car_args);
if($cars->have_posts()):
while($cars->have_posts()):
$cars->the_post();
?>
<article class="service">
<div class="right_col">
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
</div><!--right_col-->
<aside class="side_bar">
<ul>
<!-- I would like to add the thumbnails here -->
</ul>
</aside>
</article><!-- service-->
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div><!--content_div-->
I have posts about car's with category name 'car', I'm using the category name in the WP_Query.
Some of these posts have images. If there are images with the post I would like to add them as a list in the aside.