WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to WP so I'm still finding my way around.

I want to create a simple list of thumbnails. In html I have done this like so

        <li><a href="images/personal01.jpg"><img src="images/personal01.jpg" /></a></li>
        <li><a href="images/personal03.jpg"><img src="images/personal03.jpg" /></a></li>
        <li><a href="images/personal04.jpg"><img src="images/personal04.jpg" /></a></li>
        <li><a href="images/personal05.jpg"><img src="images/personal05.jpg" /></a></li>


In WP I have simply added thumbnails to a page with Upload/Insert and picked thumbnail from the Add Media window.

I have used this php to add the content to the page

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>


        <?php the_content(); ?>


    <?php endwhile; ?>
    <?php endif; ?>

This outputs code like this, each img is wrapped in an "p" tag


            <p><a href="http://localhost/wordpress/wp-content/uploads/2012/11/personal14.jpg"><img class="alignnone size-thumbnail wp-image-32" title="personal14" src="http://localhost/wordpress/wp-content/uploads/2012/11/personal14-221x150.jpg" alt="" width="221" height="150" /></a></p>
    <p><a href="http://localhost/wordpress/wp-content/uploads/2012/11/personal13.jpg"><img class="alignnone size-thumbnail wp-image-31" title="personal13" src="http://localhost/wordpress/wp-content/uploads/2012/11/personal13-199x150.jpg" alt="" width="199" height="150" /></a></p>
    <p><a href="http://localhost/wordpress/wp-content/uploads/2012/11/personal12.jpg"><img class="alignnone size-thumbnail wp-image-30" title="personal12" src="http://localhost/wordpress/wp-content/uploads/2012/11/personal12-199x150.jpg" alt="" width="199" height="150" /></a></p>


Is it possible to surround each img width a "li" tag instead of a "p" tag so it's like the original html code.

share|improve this question
up vote 0 down vote accepted

If this is a post loop can't you just put your images in li's within the editor. Just select them and put them into a bulleted list.

share|improve this answer
oH I didn't realise you could put them into a bullet list like that - that's that sorted then, thanks – user668499 Nov 15 '12 at 17:43

Your Answer


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.