Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #3835

    Guys I have a question I hope You can help:

    I’m using append to content in TDO mini form plugin with the code from (MEMBER: crazywp) that displays all the images from every post. I would like to modify it but I am poor in php to make the code grab only the attachments from the post the submitter has published, and not every attachment from every post in the blog:

    Thank You in advance :)

    current code:


    $attachments = get_children( array(‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’) );

    foreach ( $attachments as $attachment_id => $attachment ) {

    echo ‘<div style=”float:left;margin:0px 5px 0px 0px;background:#eeeeee;border:1px solid #bbb;padding:5px;” >’;

    echo ‘ ‘ . wp_get_attachment_link( $attachment_id ) . ”;

    echo ‘</div>’;

    } ?>


    I’ve found this code to be working for me which takes attachment (image) and puts it in the post :


    $args = array(

    ‘order’ => ‘ASC’,

    ‘post_type’ => ‘attachment’,

    ‘post_parent’ => $post->ID,

    ‘post_mime_type’ => ‘image’,

    ‘post_status’ => null,

    ‘numberposts’ => -1,


    $attachments = get_posts($args);

    if ($attachments) {

    foreach ($attachments as $attachment) {

    echo apply_filters(‘the_title’, $attachment->post_title);

    echo wp_get_attachment_link($attachment->ID, ‘thumbnail’, false, false);





    Now I have the image shown in the post when I attach it to the form, but Now I don’t have a preview in the home page of that image attachment. I’m also using a plugin auto post thumbnail, so I’m confused.

    Please help :) Cheers!



    basically you must modify kriesi_post_thumb.php ( located in framework > helper_function folder ). The preview images are retrieved by following code:

    //get the full size image as well as the resized. if the url is the same then there was no resize and we need to use timthumb
    $image_src = wp_get_attachment_image_src($thumbnail_id, $option['size'][0]);
    $image_src2 = wp_get_attachment_image_src($thumbnail_id, NULL);

    However I can’t help you with the modification because it may take some time and is beyond the scope of this support forum.


    Ofcourse, thank You for the info…

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘tdo mini form append to post code for images’ is closed to new replies.