WordPress.org

Ready to get started?Download WordPress

Forums

Attachments
Where to put code in my template (1 post)

  1. traceelements
    Member
    Posted 2 years ago #

    I have a child theme for Twenty Ten, and I have a copy of the loop.php file in my child theme's folder. Is that where I put the code for the attachments plugin?

    <?php
      if( function_exists( 'attachments_get_attachments' ) )
      {
        $attachments = attachments_get_attachments();
        $total_attachments = count( $attachments );
        if( $total_attachments ) : ?>
          <ul>
          <?php for( $i=0; $i<$total_attachments; $i++ ) : ?>
            <li><?php echo $attachments[$i]['title']; ?></li>
            <li><?php echo $attachments[$i]['caption']; ?></li>
            <li><?php echo $attachments[$i]['id']; ?></li>
            <li><?php echo $attachments[$i]['location']; ?></li>
            <li><?php echo $attachments[$i]['mime']; ?></li>
          <?php endfor; ?>
          </ul>
        <?php endif; ?>
    <?php } ?>

    In what part of the file should I put the code? Any help would be greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic