Files
2026-04-23 04:33:43 +03:30

109 lines
4.9 KiB
PHP

<?php
/**
* The Template for displaying content events.
*
* Override this template by copying it to yourtheme/wp-events-manager/content-event.php
*
* @author ThimPress, leehld
* @package WP-Events-Manager/Template
* @version 2.1.7
*/
/**
* Prevent loading this file directly
*/
defined( 'ABSPATH' ) || exit();
$upstudy_archive_events_style = Upstudy::setting( 'tp_events_archive_style' );
$upstudy_archive_tp_event_date = Upstudy::setting( 'upstudy_archive_tp_event_date' );
$upstudy_archive_tp_event_price = Upstudy::setting( 'upstudy_archive_tp_event_price' );
$upstudy_archive_tp_event_location = Upstudy::setting( 'upstudy_archive_tp_event_location' );
$upstudy_archive_tp_event_excerpt = Upstudy::setting( 'upstudy_archive_tp_event_excerpt' );
$tp_event_excerpt_words = Upstudy::setting( 'tp_event_excerpt_words' );
$tp_event_read_more_enable = Upstudy::setting( 'upstudy_archive_tp_event_read_more' );
$tp_event_read_more_text = Upstudy::setting( 'tp_event_read_more_text' );
$event = new WPEMS_Event( get_the_ID() );
$upstudy_tp_event_thumb_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'upstudy-post-thumb' );
if ( isset( $upstudy_tp_event_thumb_src ) && ! empty( $upstudy_tp_event_thumb_src ) ) :
$upstudy_tp_event_thumb_url = $upstudy_tp_event_thumb_src[0];
else :
$upstudy_tp_event_thumb_url = '';
endif;
$tpc_tp_event_start_time = get_post_meta( get_the_ID(), 'tp_event_date_start', true ) ? strtotime( get_post_meta( get_the_ID(), 'tp_event_date_start', true ) ) : '';
$tpc_tp_event_location = get_post_meta( get_the_ID(), 'tp_event_location', true ) ? get_post_meta( get_the_ID(), 'tp_event_location', true ) : '';
$tpc_tp_event_time_start = wpems_event_start( get_option( 'time_format' ) );
$tpc_tp_event_time_end = wpems_event_end( get_option( 'time_format' ) );
$tpc_tp_event_starting_date = wp_date( 'F j, Y', $tpc_tp_event_start_time );
$tpc_tp_event_start_date = explode( '/', $tpc_tp_event_starting_date );
// get event start day and month individuall
$start_day = wp_date( 'd', $tpc_tp_event_start_time );
$start_month = wp_date( 'M', $tpc_tp_event_start_time );
$date_enable_class = '';
if ($upstudy_archive_tp_event_date) {
$date_enable_class = 'upstudy-event-date-enable';
}
echo '<div class="tpc-event-item tpc-event-style-'.esc_attr($upstudy_archive_events_style).'">';
echo '<div class="inner upstudy-event-list '.$date_enable_class.'">';
if ( has_post_thumbnail() && get_the_post_thumbnail_url() ) :
echo '<div class="thumbnail">';
echo '<a href="' . esc_url( get_the_permalink() ) . '">';
echo '<img src="' . esc_url( $upstudy_tp_event_thumb_url ). '" alt="' . esc_attr( upstudy_thumbanil_alt_text( get_post_thumbnail_id( get_the_id() ) ) ). '" >';
echo '</a>';
echo '</div>';
endif;
echo '<div class="content">';
if ($upstudy_archive_tp_event_price){
echo '<div class="event-price">';
printf( '%s', $event->is_free() ? __( 'Free', 'upstudy' ) : wpems_format_price( $event->get_price() ) );
echo '</div>';
}
the_title( '<h5 class="event-title"><a href="' . esc_url( get_the_permalink() ) . '" class="post-link">', '</a></h5>' );
if ( $upstudy_archive_tp_event_date || $upstudy_archive_tp_event_location ) {
echo '<div class="upstudy-event-meta">';
if ( $upstudy_archive_tp_event_date ) {
echo '<span class="event-time"><i class="dt-icon-calendar"></i>'. esc_html( $tpc_tp_event_starting_date ).'</span>';
}
if ( $upstudy_archive_tp_event_location){
echo '<span class="event-location"><i class="dt-icon-maps-and-flags"></i>'. esc_html( $tpc_tp_event_location ).'</span>';
}
echo '</div>';
}
if ( $upstudy_archive_tp_event_excerpt ) :
echo '<div class="excerpt-text">';
echo wpautop( wp_trim_words( wp_kses_post( get_the_excerpt() ), $tp_event_excerpt_words ) );
echo '</div>';
endif;
if($tp_event_read_more_enable){
echo '<div class="read-more">';
echo '<a href="' . esc_url( get_the_permalink() ) . '">';
echo (!empty($tp_event_read_more_text)) ? esc_html($tp_event_read_more_text) : 'About This Event';
echo '</a>';
echo '</div>';
}
echo '</div>';
if ( $upstudy_archive_tp_event_date ){
echo '<div class="upstudy-event-date">';
echo '<span class="day">'.$start_day.'</span>';
echo '<span class="month">'.$start_month.'</span>';
echo '</div>';
};
echo '</div>';
echo '</div>';