• Resolved Cathy Mitchell

    (@multitalentedmommy)


    I want to show the image of the post being displayed. Can anyone tell me how to combine these two?
    In the loop, (I think), I have the_ID (for the current post, right?) How would I replace the “13” below with the_ID tag?

    <?php the_attachment_link( 13, false, array(280, 125) );?>

    Simply inserting it like so, does NOT work: (I think)
    <?php the_attachment_link(<?php the_ID();?>, false, array(280, 125) );?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => null,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	);
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		echo the_attachment_link($attachment->ID, false);
    	}
    }
    
    ?>
    Thread Starter Cathy Mitchell

    (@multitalentedmommy)

    that is so perfect! Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can I combine the_attachmen_link with the the_id in the loop?’ is closed to new replies.