Getting a Post's Featured Image URL
-
Hello all,
Im trying to get a new feature going for one of my websites and the home page is going to feature a news slider where i will display my latest post along with the set feature image for that post.
What im trying to get is the Featured Image URL in-order to set it as a background image of my DIV. Is this possible to do?
Here is my code:
<div id="slider"> <div class="content" style="background:url(FEATURED IMAGE URL HERE)"> <div style="margin-top:250px; margin-left:10px; margin-right:10px; height:120px; padding:2px; background:url(<?php echo get_option('home'); ?>/main-table-content-bg.png); background-repeat:repeat"> <?php query_posts('showposts=1&category_name=topstories'); ?> <?php while (have_posts()): the_post(); ?> <h3><a href="<?php the_permalink(); ?>" title="Read full post"><?php the_title(); ?></a></h3> <?php the_excerpt();?> <?php endwhile; ?> </div> </div> </div>
Thanks in advance!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Getting a Post's Featured Image URL’ is closed to new replies.