• Hello,
    I created custom attachment.php

    `<?php get_header(); ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php $attachment_link = get_the_attachment_link($post->ID, true, array());?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>

    <div class=”entrytext”>
    <p class=”<?php echo $classname; ?>”><?php echo $attachment_link; ?></p>
    </div>

    <?php endwhile; else: ?>

    <p>Sorry, no attachments matched your criteria.</p>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>`

    I added $attachment_link; but its link to original file as well. can someone tell me the code to get full size attached image only that do not link to any where.

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • joyced

    (@joyced)

    Same question. ^ I just need the image url so I can apply a class to it. Google isn’t helping.

    joyced

    (@joyced)

    Ahem, I take that back. Now using this:

    <img src="<?php echo wp_get_attachment_url(); ?>" alt="" />

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘need help for in attachment.php’ is closed to new replies.