jchristopher / attachments

[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
wordpress.org/extend/plugins/attachments/
GNU General Public License v2.0
239 stars 78 forks source link

Change echo $attachments->src( 'full' ) image size? #56

Closed vol4ikman closed 11 years ago

vol4ikman commented 11 years ago

How can I change the "echo $attachments->src( 'full' )" image size or add new parameter, like "medium" and "small".

Does it possible? Thank U!

jchristopher commented 11 years ago
echo $attachments->src( 'full' ); // full size
echo $attachments->src( 'medium' ); // medium size
echo $attachments->src( 'small' ); // small size
vol4ikman commented 11 years ago

it is not work for me <?php $attachments = new Attachments( 'my_attachments' ); ?> <?php if( $attachments->exist() ) : ?> <?php while( $attachments->get() ) : ?>

img src="src( 'small' ); ?>" alt="src( 'medium' ); ?>" field( 'title' ); ?>
    <?php endwhile; ?>
    <?php endif; ?>

<?php endwhile;?>

I need display attachment url 2 times, 1- in image source and 2- in image alt

jchristopher commented 11 years ago

The src() method retrieves the URL to the image of the size passed to it, it won't provide the alt text.