• i am using

    <?php //Get image genererated from form
    $argsThumb = array(
        'order'          => 'ASC',
        'post_type'      => 'attachment',
        'post_parent'    => $post->ID,
        'post_mime_type' => 'image',
        'post_status'    => null
    );
    $attachments = get_posts($argsThumb);
    if ($attachments) {
        foreach ($attachments as $attachment) {
            //echo apply_filters('the_title', $attachment->post_title);
            echo '<a href='.wp_get_attachment_url($attachment->ID, 'thumbnail', false, false).'><img src="'.wp_get_attachment_url ($attachment->ID, 'thumbnail', false, false).'" /></a>';
        }
    }
    ?>

    to display image attachments that were added to posts created with formidable pro.

    I want to be able to have when clicked, the image link to the post id, not to the image.

    Does anyone know how i have to edit the above code so that when clicked the image will link to the post its attached to and not its own image url?

    Thanks a bunch.

  • The topic ‘Attachment link to Post ID’ is closed to new replies.