announcements.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Announcements |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Single\Course\Enrolled |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 1.0.0 |
| 10 | */ |
| 11 | |
| 12 | $announcements = tutor_utils()->get_announcements( get_the_ID() ); |
| 13 | ?> |
| 14 | |
| 15 | <?php do_action( 'tutor_course/announcements/before' ); ?> |
| 16 | |
| 17 | <?php if ( is_array( $announcements ) && count( $announcements ) ) : ?> |
| 18 | <?php foreach ( $announcements as $announcement ) : ?> |
| 19 | <div class="tutor-card tutor-announcement-card tutor-mb-32"> |
| 20 | <div class="tutor-card-header tutor-d-block tutor-bg-gray-10"> |
| 21 | <h3 class="tutor-card-title"><?php echo esc_html( $announcement->post_title ); ?></h3> |
| 22 | |
| 23 | <div class="tutor-meta tutor-mt-16"> |
| 24 | <div> |
| 25 | <?php |
| 26 | echo wp_kses( |
| 27 | tutor_utils()->get_tutor_avatar( $announcement->post_author, 'sm' ), |
| 28 | tutor_utils()->allowed_avatar_tags() |
| 29 | ); |
| 30 | ?> |
| 31 | </div> |
| 32 | |
| 33 | <div> |
| 34 | <span class="tutor-meta-key"><?php esc_html_e( 'By', 'tutor' ); ?></span> |
| 35 | <span class="tutor-meta-value"><?php echo esc_html( get_userdata( $announcement->post_author )->display_name ); ?></span> |
| 36 | </div> |
| 37 | |
| 38 | <div> |
| 39 | <?php |
| 40 | /* translators: %s: time difference */ |
| 41 | echo esc_html( sprintf( __( '%s ago', 'tutor' ), human_time_diff( strtotime( $announcement->post_date_gmt ) ) ) ); |
| 42 | ?> |
| 43 | </div> |
| 44 | </div> |
| 45 | </div> |
| 46 | |
| 47 | <div class="tutor-card-body"> |
| 48 | <div class="tutor-fs-6 tutor-color-secondary"> |
| 49 | <?php |
| 50 | echo tutor_utils()->announcement_content( wpautop( stripslashes( $announcement->post_content ) ) ) //phpcs:ignore; |
| 51 | ?> |
| 52 | </div> |
| 53 | </div> |
| 54 | </div> |
| 55 | <?php endforeach; ?> |
| 56 | <?php else : ?> |
| 57 | <div> |
| 58 | <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?> |
| 59 | </div> |
| 60 | <?php endif; ?> |
| 61 | |
| 62 | <?php do_action( 'tutor_course/announcements/after' ); ?> |
| 63 |