92 lines
3.3 KiB
PHP
92 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* БИТ.WMS Child Theme — single-event.php
|
|
*
|
|
* Single (detail) template for the 'event' custom post type.
|
|
*
|
|
* ACF fields used:
|
|
* event_date — date picker (YYYY-MM-DD)
|
|
* event_location — text
|
|
* event_format — text (e.g. "Очно", "Онлайн", "Гибридный")
|
|
* event_program — wysiwyg
|
|
* event_register_url — url (optional; falls back to demo form)
|
|
*
|
|
* @package bitwms-child
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
get_header();
|
|
the_post();
|
|
|
|
$event_date = get_field( 'event_date' );
|
|
$location = get_field( 'event_location' );
|
|
$format = get_field( 'event_format' );
|
|
$program = get_field( 'event_program' );
|
|
$register_url = get_field( 'event_register_url' ) ?: home_url( '/bit-wms/#demo-form' );
|
|
?>
|
|
<main class="single-event">
|
|
<div class="container">
|
|
<article>
|
|
<h1><?php the_title(); ?></h1>
|
|
|
|
<div class="single-event__meta">
|
|
<?php if ( $event_date ) : ?>
|
|
<span class="single-event__meta-item single-event__date">
|
|
<strong><?php esc_html_e( 'Дата:', 'bitwms-child' ); ?></strong>
|
|
<?php echo esc_html( date_i18n( 'd.m.Y', strtotime( $event_date ) ) ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php if ( $location ) : ?>
|
|
<span class="single-event__meta-item single-event__location">
|
|
<strong><?php esc_html_e( 'Место:', 'bitwms-child' ); ?></strong>
|
|
<?php echo esc_html( $location ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php if ( $format ) : ?>
|
|
<span class="single-event__meta-item single-event__format">
|
|
<strong><?php esc_html_e( 'Формат:', 'bitwms-child' ); ?></strong>
|
|
<?php echo esc_html( $format ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if ( $program ) : ?>
|
|
<div class="single-event__section">
|
|
<h2><?php esc_html_e( 'Программа', 'bitwms-child' ); ?></h2>
|
|
<?php echo wp_kses_post( $program ); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="single-event__cta">
|
|
<a href="<?php echo esc_url( $register_url ); ?>" class="btn btn-primary">
|
|
<?php esc_html_e( 'Зарегистрироваться', 'bitwms-child' ); ?>
|
|
</a>
|
|
</div>
|
|
</article>
|
|
|
|
<?php
|
|
$related = new WP_Query( array(
|
|
'post_type' => 'event',
|
|
'posts_per_page' => 3,
|
|
'orderby' => 'rand',
|
|
'post__not_in' => array( get_the_ID() ),
|
|
) );
|
|
if ( $related->have_posts() ) :
|
|
?>
|
|
<section class="related-posts">
|
|
<h2><?php esc_html_e( 'Другие мероприятия', 'bitwms-child' ); ?></h2>
|
|
<div class="content-grid">
|
|
<?php while ( $related->have_posts() ) : $related->the_post(); ?>
|
|
<?php get_template_part( 'templates/content-card' ); ?>
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</section>
|
|
<?php
|
|
wp_reset_postdata();
|
|
endif;
|
|
?>
|
|
</div>
|
|
</main>
|
|
<?php get_footer();
|