feat: add archive and single templates for all custom post types

This commit is contained in:
2026-04-03 01:17:20 +05:00
parent fe22b37b0e
commit 49709e8cf8
9 changed files with 565 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php
/**
* БИТ.WMS Child Theme — archive-case.php
*
* Archive template for the 'case' custom post type.
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main class="archive-page">
<div class="container">
<h1 class="archive-page__title"><?php esc_html_e( 'Кейсы', 'bitwms-child' ); ?></h1>
<div class="content-grid">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'templates/content-card' ); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e( 'Кейсы не найдены.', 'bitwms-child' ); ?></p>
<?php endif; ?>
</div>
<?php the_posts_pagination( array( 'prev_text' => '&larr;', 'next_text' => '&rarr;' ) ); ?>
</div>
</main>
<?php get_footer();
@@ -0,0 +1,29 @@
<?php
/**
* БИТ.WMS Child Theme — archive-course.php
*
* Archive template for the 'course' custom post type.
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main class="archive-page">
<div class="container">
<h1 class="archive-page__title"><?php esc_html_e( 'Курсы', 'bitwms-child' ); ?></h1>
<div class="content-grid">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'templates/content-card' ); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e( 'Курсы не найдены.', 'bitwms-child' ); ?></p>
<?php endif; ?>
</div>
<?php the_posts_pagination( array( 'prev_text' => '&larr;', 'next_text' => '&rarr;' ) ); ?>
</div>
</main>
<?php get_footer();
@@ -0,0 +1,29 @@
<?php
/**
* БИТ.WMS Child Theme — archive-event.php
*
* Archive template for the 'event' custom post type.
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main class="archive-page">
<div class="container">
<h1 class="archive-page__title"><?php esc_html_e( 'Мероприятия', 'bitwms-child' ); ?></h1>
<div class="content-grid">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'templates/content-card' ); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e( 'Мероприятия не найдены.', 'bitwms-child' ); ?></p>
<?php endif; ?>
</div>
<?php the_posts_pagination( array( 'prev_text' => '&larr;', 'next_text' => '&rarr;' ) ); ?>
</div>
</main>
<?php get_footer();
@@ -0,0 +1,29 @@
<?php
/**
* БИТ.WMS Child Theme — archive-material.php
*
* Archive template for the 'material' custom post type.
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main class="archive-page">
<div class="container">
<h1 class="archive-page__title"><?php esc_html_e( 'Материалы', 'bitwms-child' ); ?></h1>
<div class="content-grid">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'templates/content-card' ); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e( 'Материалы не найдены.', 'bitwms-child' ); ?></p>
<?php endif; ?>
</div>
<?php the_posts_pagination( array( 'prev_text' => '&larr;', 'next_text' => '&rarr;' ) ); ?>
</div>
</main>
<?php get_footer();
@@ -0,0 +1,29 @@
<?php
/**
* БИТ.WMS Child Theme — archive-webinar.php
*
* Archive template for the 'webinar' custom post type.
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main class="archive-page">
<div class="container">
<h1 class="archive-page__title"><?php esc_html_e( 'Вебинары', 'bitwms-child' ); ?></h1>
<div class="content-grid">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'templates/content-card' ); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e( 'Вебинары не найдены.', 'bitwms-child' ); ?></p>
<?php endif; ?>
</div>
<?php the_posts_pagination( array( 'prev_text' => '&larr;', 'next_text' => '&rarr;' ) ); ?>
</div>
</main>
<?php get_footer();
@@ -0,0 +1,129 @@
<?php
/**
* БИТ.WMS Child Theme — single-case.php
*
* Single (detail) template for the 'case' custom post type.
*
* ACF fields used:
* case_client — text
* case_industry — text
* case_task — wysiwyg
* case_solution — wysiwyg
* case_result — wysiwyg
* case_quote — text
* case_gallery — gallery (array of image arrays)
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
the_post();
$client = get_field( 'case_client' );
$industry = get_field( 'case_industry' );
$task = get_field( 'case_task' );
$solution = get_field( 'case_solution' );
$result = get_field( 'case_result' );
$quote = get_field( 'case_quote' );
$gallery = get_field( 'case_gallery' );
?>
<main class="single-case">
<div class="container">
<article>
<h1><?php the_title(); ?></h1>
<?php if ( $client || $industry ) : ?>
<div class="single-case__meta">
<?php if ( $client ) : ?>
<span class="single-case__meta-item single-case__client">
<strong><?php esc_html_e( 'Клиент:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $client ); ?>
</span>
<?php endif; ?>
<?php if ( $industry ) : ?>
<span class="single-case__meta-item single-case__industry">
<strong><?php esc_html_e( 'Отрасль:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $industry ); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( $task ) : ?>
<div class="single-case__section single-case__task">
<h2><?php esc_html_e( 'Задача', 'bitwms-child' ); ?></h2>
<?php echo wp_kses_post( $task ); ?>
</div>
<?php endif; ?>
<?php if ( $solution ) : ?>
<div class="single-case__section single-case__solution">
<h2><?php esc_html_e( 'Решение', 'bitwms-child' ); ?></h2>
<?php echo wp_kses_post( $solution ); ?>
</div>
<?php endif; ?>
<?php if ( $result ) : ?>
<div class="single-case__section single-case__result">
<h2><?php esc_html_e( 'Результат', 'bitwms-child' ); ?></h2>
<?php echo wp_kses_post( $result ); ?>
</div>
<?php endif; ?>
<?php if ( $gallery ) : ?>
<div class="single-case__gallery">
<div class="gallery-grid">
<?php foreach ( $gallery as $image ) : ?>
<a href="<?php echo esc_url( $image['url'] ); ?>" target="_blank" rel="noopener">
<img
src="<?php echo esc_url( $image['sizes']['medium_large'] ?? $image['url'] ); ?>"
alt="<?php echo esc_attr( $image['alt'] ); ?>"
width="<?php echo esc_attr( $image['sizes']['medium_large-width'] ?? $image['width'] ); ?>"
height="<?php echo esc_attr( $image['sizes']['medium_large-height'] ?? $image['height'] ); ?>"
>
</a>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if ( $quote ) : ?>
<blockquote class="single-case__quote">
<?php echo esc_html( $quote ); ?>
</blockquote>
<?php endif; ?>
<div class="single-case__cta">
<p><?php esc_html_e( 'Хотите такой же результат?', 'bitwms-child' ); ?></p>
<a href="<?php echo esc_url( home_url( '/bit-wms/#demo-form' ) ); ?>" class="btn btn-primary">
<?php esc_html_e( 'Закажите консультацию', 'bitwms-child' ); ?>
</a>
</div>
</article>
<?php
$related = new WP_Query( array(
'post_type' => 'case',
'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();
@@ -0,0 +1,91 @@
<?php
/**
* БИТ.WMS Child Theme — single-course.php
*
* Single (detail) template for the 'course' custom post type.
*
* ACF fields used:
* course_program — wysiwyg
* course_duration — text (e.g. "16 часов")
* course_format — text (e.g. "Онлайн")
* course_price — text (e.g. "35 000 ₽")
* course_register_url — url (optional; falls back to demo form)
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
the_post();
$program = get_field( 'course_program' );
$duration = get_field( 'course_duration' );
$format = get_field( 'course_format' );
$price = get_field( 'course_price' );
$register_url = get_field( 'course_register_url' ) ?: home_url( '/bit-wms/#demo-form' );
?>
<main class="single-course">
<div class="container">
<article>
<h1><?php the_title(); ?></h1>
<div class="single-course__meta">
<?php if ( $duration ) : ?>
<span class="single-course__meta-item">
<strong><?php esc_html_e( 'Продолжительность:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $duration ); ?>
</span>
<?php endif; ?>
<?php if ( $format ) : ?>
<span class="single-course__meta-item">
<strong><?php esc_html_e( 'Формат:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $format ); ?>
</span>
<?php endif; ?>
<?php if ( $price ) : ?>
<span class="single-course__meta-item single-course__price">
<strong><?php esc_html_e( 'Стоимость:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $price ); ?>
</span>
<?php endif; ?>
</div>
<?php if ( $program ) : ?>
<div class="single-course__section">
<h2><?php esc_html_e( 'Программа курса', 'bitwms-child' ); ?></h2>
<?php echo wp_kses_post( $program ); ?>
</div>
<?php endif; ?>
<div class="single-course__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' => 'course',
'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();
@@ -0,0 +1,91 @@
<?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();
@@ -0,0 +1,109 @@
<?php
/**
* БИТ.WMS Child Theme — single-webinar.php
*
* Single (detail) template for the 'webinar' custom post type.
*
* Two display modes depending on webinar_date vs today:
* Upcoming — webinar_date, webinar_speaker, webinar_program (wysiwyg), registration link.
* Past — webinar_video_embed (wysiwyg/oEmbed), webinar_presentation (file url), webinar_program.
*
* ACF fields used:
* webinar_date — date picker (YYYY-MM-DD)
* webinar_speaker — text
* webinar_program — wysiwyg
* webinar_register_url — url
* webinar_video_embed — wysiwyg (oembed or raw iframe)
* webinar_presentation — file (array with 'url' and 'filename')
*
* @package bitwms-child
*/
defined( 'ABSPATH' ) || exit;
get_header();
the_post();
$webinar_date = get_field( 'webinar_date' ); // e.g. '2026-05-10'
$speaker = get_field( 'webinar_speaker' );
$program = get_field( 'webinar_program' );
$register_url = get_field( 'webinar_register_url' );
$video_embed = get_field( 'webinar_video_embed' );
$presentation = get_field( 'webinar_presentation' );
$is_upcoming = $webinar_date && strtotime( $webinar_date ) > time();
?>
<main class="single-webinar">
<div class="container">
<article>
<h1><?php the_title(); ?></h1>
<div class="single-webinar__meta">
<?php if ( $webinar_date ) : ?>
<span class="single-webinar__date">
<strong><?php esc_html_e( 'Дата:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( date_i18n( 'd.m.Y', strtotime( $webinar_date ) ) ); ?>
</span>
<?php endif; ?>
<?php if ( $speaker ) : ?>
<span class="single-webinar__speaker">
<strong><?php esc_html_e( 'Спикер:', 'bitwms-child' ); ?></strong>
<?php echo esc_html( $speaker ); ?>
</span>
<?php endif; ?>
</div>
<?php if ( ! $is_upcoming && $video_embed ) : ?>
<div class="single-webinar__video">
<?php echo wp_kses_post( $video_embed ); ?>
</div>
<?php endif; ?>
<?php if ( $program ) : ?>
<div class="single-webinar__section">
<h2><?php esc_html_e( 'Программа', 'bitwms-child' ); ?></h2>
<?php echo wp_kses_post( $program ); ?>
</div>
<?php endif; ?>
<?php if ( $is_upcoming && $register_url ) : ?>
<div class="single-webinar__cta">
<a href="<?php echo esc_url( $register_url ); ?>" class="btn btn-primary" target="_blank" rel="noopener">
<?php esc_html_e( 'Зарегистрироваться', 'bitwms-child' ); ?>
</a>
</div>
<?php endif; ?>
<?php if ( ! $is_upcoming && $presentation ) : ?>
<div class="single-webinar__presentation">
<a href="<?php echo esc_url( $presentation['url'] ); ?>" class="btn btn-secondary" download>
<?php esc_html_e( 'Скачать презентацию', 'bitwms-child' ); ?>
</a>
</div>
<?php endif; ?>
</article>
<?php
$related = new WP_Query( array(
'post_type' => 'webinar',
'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();