formatting post title within the loo[
-
I’m trying to organize a display of posts in the category ‘garage’ on one page of my site.
I want them to display in a sort of grid with the title directly below the thumbnail. So far the grid and thumbnails are working, but the title is displaying to the right of the thumbnail and not directly under the thumbnail.
Here is a screenshot of how it is currently displaying and the code I used: https://imgur.com/a/tTn38
I’d link to the site but its currently not publicly visible since I’m still building it.here’s my code:
<?php $my_query = new WP_Query('post_type=post&category_name=Garage'); while ($my_query->have_posts()) : $my_query->the_post(); ?> <a href="<?php the_permalink();?>"><?php the_post_thumbnail('thumbnail');?><?php the_title();?></a> <?php endwhile; ?>
Is there a change I can make in the loop code to get the title to display directly underneath the thumbnail. I’ve tried using
but it ruins the grid effect by putting each thumbnail on a new line. Perhaps I just didn’t place it correctly. Thanks in advance for the help!
- The topic ‘formatting post title within the loo[’ is closed to new replies.