Support » How-To and Troubleshooting » Separating images and text in a single post

Separating images and text in a single post

  • Problem:
    Inside single.php;
    I want my images displayed in another div than the the rest of my content (rest of content, the text). I’ve read about the strip tag function, but couldn’t get it to work.

    A simple example
    <div id=”images”>images</div>
    <div id=”text”>text</div>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Wouldn’t it be easier to use something like NextGen?

    Thanks, but I don’t really like NextGen — and I’m trying to avoid using any plugins for this. It should be really simple, but obviously I don’t know enough PHP to get the get_content to display images in one div and text in another. I hope someone will be able to help out?

    OK, so this gets only the images:

    $images =& get_children( ‘post_type=attachment&post_mime… . $post->ID );
    foreach( $images as $imageID => $imagePost )
    echo wp_get_attachment_image($imageID… ‘thumbnail’, false);
    How do I get the rest of the content into the other div, with images being the only exception?

    This code removes images from a post

    but doesn’t link to the attachments page or show alt info, how do I include all that?

    What about combining your last two posts?

    Yes, I did.. the only problem I have is that the image column doesn’t link to the attachmentspage, unless I use `echo wp_get_attachment_link’ but then the thumbnails code stops working. I’ve sort of hacked it through css, but I’m still sure that there is an easier way to hack this (without using plugins).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Separating images and text in a single post’ is closed to new replies.
Skip to toolbar