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() ) : ?>
      <h3>Attachments</h3>
      <p>Total Attachments: <?php echo $attachments->total(); ?></p>
      <ul>
        <?php while( $attachments->get() ) : ?>
          <li>
            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' ); ?>
          </li>
        <?php endwhile; ?>
      </ul>
    <?php endif; ?>

    thanks a lot

    https://wordpress.org/plugins/attachments/

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