attachments.php
45 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display attachments |
| 4 | * |
| 5 | * @since v.1.0.0 |
| 6 | * @author themeum |
| 7 | * @url https://themeum.com |
| 8 | * |
| 9 | * @package TutorLMS/Templates |
| 10 | * @version 1.4.3 |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | $attachments = tutor_utils()->get_attachments(); |
| 18 | $open_mode_view = apply_filters( 'tutor_pro_attachment_open_mode', null ) == 'view' ? ' target="_blank" ' : null; |
| 19 | |
| 20 | do_action( 'tutor_global/before/attachments' ); |
| 21 | |
| 22 | if ( is_array( $attachments ) && count( $attachments ) ) { |
| 23 | ?> |
| 24 | <div class="tutor-page-segment tutor-attachments-wrap"> |
| 25 | <h3><?php _e( 'Attachments', 'tutor' ); ?></h3> |
| 26 | <?php |
| 27 | foreach ( $attachments as $attachment ) { |
| 28 | ?> |
| 29 | <a href="<?php echo esc_url( $attachment->url ); ?>" <?php echo $open_mode_view ? $open_mode_view : ' download="' . $attachment->name . '" '; ?> class="tutor-lesson-attachment clearfix"> |
| 30 | <div class="tutor-attachment-icon"> |
| 31 | <i class="tutor-icon-<?php echo esc_attr( $attachment->icon ); ?>"></i> |
| 32 | </div> |
| 33 | <div class="tutor-attachment-info"> |
| 34 | <span><?php echo esc_attr( $attachment->name ); ?></span> |
| 35 | <span><?php echo esc_attr( $attachment->size ); ?></span> |
| 36 | </div> |
| 37 | </a> |
| 38 | <?php |
| 39 | } |
| 40 | ?> |
| 41 | </div> |
| 42 | <?php } |
| 43 | |
| 44 | do_action( 'tutor_global/after/attachments' ); ?> |
| 45 |