Calling an attached image
-
I’m already using this code to call thumbnails:
<?php $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); } } ?>When you click on a thumbnail, you get this larger image as a result:
This is the result I want, however, I don’t want that large image to be clickable.
The attachment.php code looks like this:
<?php $attachment_link = get_the_attachment_link($post->ID, true, array(515, 800)); // This also populates the iconsize for the next line ?> <?php $_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment'; // This lets us style narrow icons specially ?> <?php echo $attachment_link; ?><br /> <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>Obviously the code in attachment.php needs to change, but I don’t know what to change it to. Nothing seems to work.
We are in dire need of an update to the WordPress Attachment Codex.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Calling an attached image’ is closed to new replies.