Support » Plugin: Attachments » view attachment from timber

  • hello,

    i have theme gantry, that use timber and twig file for frontend
    there is a code to past in frontend for retrive value of attach

    i test this code but i don’t see nothing

    <?php $attachments = new Attachments( 'attachments' ); /* pass the instance name */ ?>
    <?php if( $attachments->exist() ) : ?>
      <p>Total Attachments: <?php echo $attachments->total(); ?></p>
        <?php while( $attachments->get() ) : ?>
            ID: <?php echo $attachments->id(); ?><br />
            Type: <?php echo $attachments->type(); ?><br />
            Subtype: <?php echo $attachments->subtype(); ?><br />
            URL: <?php echo $attachments->url(); ?><br />
            Image: <?php echo $attachments->image( 'thumbnail' ); ?><br />
            Source: <?php echo $attachments->src( 'full' ); ?><br />
            Size: <?php echo $attachments->filesize(); ?><br />
            Title Field: <?php echo $attachments->field( 'title' ); ?><br />
            Caption Field: <?php echo $attachments->field( 'caption' ); ?>
        <?php endwhile; ?>
    <?php endif; ?>

    thanks a lot

  • The topic ‘view attachment from timber’ is closed to new replies.