Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

WordPress: Wrap img in DIV

Options
  • 11-12-2012 12:51pm
    #1
    Registered Users Posts: 43


    HI,

    I'm working on a WordPress site and want to be able to wrap the images in posts in a div when they are added through upload/insert section when your editing a page.

    i.e when someone uploads an image it is wrapped in a div with a class name separate to the text.

    at the moment my code looks like this

    <div class="container">
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <div class="eight columns alpha">
    <h3><?php the_title(); ?></h3>
    <?php the_content(); ?>
    </div>
    <div class="eight columns omega">
    <!-- Where I want the image to go -->
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>

    I get that the <?php the_content(); ?> is calling all content on the page that's why all content is showing in the first div and the second is empty. Is there a way to differentiate between text and images in a post/page?

    Any help on this would be great

    Cheers


Comments

Advertisement