Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to be able to seperate the first image form the post into a <div> tag and link it to the post page and be able to add html around the post text elements seprately.

Any help is greatly appreciated

This is what I have tried

                query_posts('posts_per_page=1&tag=food');
                while (have_posts()) : the_post();
                echo "<li class='homePost'>\n";
                    echo the_content();
                    echo '<a href="' . get_permalink() . '">';
                    the_title();
                    echo '</a>'; 

                echo "</li>\n";
                endwhile;
share|improve this question
    
I guess this is what the featured image is meant to replace... –  kalpaitch Oct 22 '12 at 12:54
add comment

1 Answer

up vote 2 down vote accepted

Look at this snippet from CSS-Tricks. It gets the first image from a post.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.