Hey everyone… I am at a loss 🙁 I got this far but I am only able to pull a static image with the post to display on my home page… I would like to dynamically display the featured image for the post… Here is the code I have so far
<?php $the_query = new WP_Query( 'showposts=3' ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <ul class="one_up tiles"> <!-- Get the single service --> <li class="service"> <div class="two columns"> <img src="<?php echo get_template_directory_uri(); ?>/images/blogpost.png" alt="blog-post" /> </div> <div class="nine columns"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <p><?php echo string_limit_words(get_the_excerpt(), 35); ?></p> </div> </li> </ul>
I am pretty sure I need to put new code where it says img src=
Does anyone know what code I need to dynamically grab the featured image for the post that I am pulling?
Like for the words I was able to put
(get_the_excerpt(), 35)to make sure I was not pulling the whole post…
Thank you so much for any help…
- The topic ‘Display Featured Image with latest post grab’ is closed to new replies.