WordPress.org

Ready to get started?Download WordPress

Forums

Attachments
[resolved] Attachments doesn't appear in my theme (3 posts)

  1. bondweb
    Member
    Posted 2 years ago #

    I'm using a shape5 theme, plug-in work fine in wp-admin but I cannot see attachments in front end, why?

    http://wordpress.org/extend/plugins/attachments/

  2. Lukis
    Member
    Posted 2 years ago #

    You will need to edit your theme files where applicable.

    Here is a basic implementation:

    <?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>
            <li><?php echo $attachments[$i]['filesize']; ?></li>
          <?php endfor; ?>
          </ul>
        <?php endif; ?>
    <?php } ?>
  3. Jonathan Christopher
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks so much for posting that snippet, Lukis!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic