403Webshell
Server IP : 104.171.130.249  /  Your IP : 216.73.216.146
Web Server : nginx/1.25.5
System : Linux 0dac65491b7e 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/themes/matreshka/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/matreshka/single-promotion.php
<?php
/**
 * Template: Single Promotion (Акция) page
 * Styled like Pyaterochka promo pages
 */
get_header();

while ( have_posts() ) : the_post();
	$promo_id   = get_the_ID();

	// Redirect to category if enabled
	$redirect_cat = get_post_meta( $promo_id, '_promo_redirect_to_category', true );
	$cat_id       = get_post_meta( $promo_id, '_promo_category', true );
	if ( $redirect_cat && $cat_id ) {
		$cat_link = get_term_link( (int) $cat_id, 'product_cat' );
		if ( ! is_wp_error( $cat_link ) ) {
			wp_redirect( $cat_link, 301 );
			exit;
		}
	}

	$start_date = get_post_meta( $promo_id, '_promo_date_start', true );
	$end_date   = get_post_meta( $promo_id, '_promo_date_end', true );
	$badge_text = get_post_meta( $promo_id, '_promo_badge_text', true );
	$badge_color = get_post_meta( $promo_id, '_promo_badge_color', true ) ?: '#A92231';
	$conditions = get_post_meta( $promo_id, '_promo_conditions', true );
	$hero_id    = get_post_meta( $promo_id, '_promo_hero_image', true );
	$hero_url   = $hero_id ? wp_get_attachment_image_url( $hero_id, 'full' ) : '';
	$linked_ids = get_post_meta( $promo_id, '_promo_linked_products', true );
	$days_left  = matreshka_promo_days_left( $end_date );

	// Date labels
	$start_label = '';
	$end_label   = '';
	if ( $start_date ) {
		$months_gen = ['01'=>'января','02'=>'февраля','03'=>'марта','04'=>'апреля','05'=>'мая','06'=>'июня','07'=>'июля','08'=>'августа','09'=>'сентября','10'=>'октября','11'=>'ноября','12'=>'декабря'];
		$sp = explode( '-', $start_date );
		$ep = explode( '-', $end_date );
		$start_label = ltrim( $sp[2], '0' ) . ' ' . ( $months_gen[ $sp[1] ] ?? '' );
		$end_label   = ltrim( $ep[2], '0' ) . ' ' . ( $months_gen[ $ep[1] ] ?? '' );
	}
?>

<main class="site-main promo-single-page">

	<!-- Hero -->
	<?php if ( $hero_url ) : ?>
	<div class="promo-hero">
		<img src="<?php echo esc_url( $hero_url ); ?>" alt="<?php the_title_attribute(); ?>" class="promo-hero-img">
		<div class="promo-hero-overlay">
			<div class="container">
				<div class="promo-hero-content">
					<?php if ( $badge_text ) : ?>
						<span class="promo-hero-badge montserrat-bold" style="background-color:<?php echo esc_attr( $badge_color ); ?>;"><?php echo esc_html( $badge_text ); ?></span>
					<?php endif; ?>
					<h1 class="promo-hero-title montserrat-bold"><?php the_title(); ?></h1>
				</div>
			</div>
		</div>
	</div>
	<?php else : ?>
	<div class="promo-hero promo-hero--gradient">
		<div class="container">
			<div class="promo-hero-content promo-hero-content--no-img">
				<?php if ( $badge_text ) : ?>
					<span class="promo-hero-badge montserrat-bold" style="background-color:<?php echo esc_attr( $badge_color ); ?>;"><?php echo esc_html( $badge_text ); ?></span>
				<?php endif; ?>
				<h1 class="promo-hero-title montserrat-bold"><?php the_title(); ?></h1>
			</div>
		</div>
	</div>
	<?php endif; ?>

	<div class="container">

		<!-- Info bar -->
		<div class="promo-info-bar">
			<div class="promo-info-dates">
				<div class="promo-info-icon">
					<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/sell.svg' ); ?>" alt="promo" width="20" height="20">
				</div>
				<div>
					<span class="promo-info-label montserrat-medium">Период акции</span>
					<span class="promo-info-value montserrat-bold"><?php echo esc_html( $start_label ); ?> — <?php echo esc_html( $end_label ); ?></span>
				</div>
			</div>
			<?php if ( $days_left > 0 ) : ?>
			<div class="promo-info-countdown <?php echo $days_left <= 3 ? 'promo-info-countdown--urgent' : ''; ?>">
				<?php if ( $days_left <= 3 ) : ?>
					<span class="promo-countdown-fire">🔥</span>
				<?php endif; ?>
				<span class="promo-countdown-text montserrat-bold">
					<?php
					if ( $days_left === 0 ) {
						echo 'Последний день!';
					} elseif ( $days_left === 1 ) {
						echo 'Остался 1 день';
					} elseif ( $days_left <= 4 ) {
						echo "Осталось {$days_left} дня";
					} else {
						echo "Осталось {$days_left} дней";
					}
					?>
				</span>
			</div>
			<?php else : ?>
			<div class="promo-info-countdown promo-info-countdown--ended">
				<span class="promo-countdown-text montserrat-bold">Акция завершена</span>
			</div>
			<?php endif; ?>
		</div>

		<!-- Content -->
		<div class="promo-content-wrap">
			<div class="promo-content montserrat-medium">
				<?php the_content(); ?>
			</div>
		</div>

		<!-- Conditions -->
		<?php if ( $conditions ) : ?>
		<div class="promo-conditions">
			<div class="promo-conditions-header" id="promo-conditions-toggle">
				<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/InfoCircle.svg' ); ?>" alt="info" width="20" height="20">
				<span class="montserrat-bold">Условия акции</span>
				<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/ArrowDown.svg' ); ?>" alt="expand" width="16" height="16" class="promo-conditions-arrow rotated">
			</div>
			<div class="promo-conditions-body montserrat-medium">
				<?php echo wpautop( esc_html( $conditions ) ); ?>
			</div>
		</div>
		<?php endif; ?>

		<!-- Linked products -->
		<?php
		$product_ids = [];
		if ( $linked_ids ) {
			$product_ids = array_filter( array_map( 'absint', explode( ',', $linked_ids ) ) );
		}
		if ( ! empty( $product_ids ) && function_exists( 'wc_get_product' ) ) :
		?>
		<div class="promo-products-section">
			<h2 class="montserrat-bold promo-section-title">
				Товары по акции
				<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/sell.svg' ); ?>" alt="promo" width="20" height="20">
			</h2>
			<div class="product-cards promo-products-grid">
				<?php foreach ( $product_ids as $pid ) :
					$product = wc_get_product( $pid );
					if ( ! $product || $product->get_status() !== 'publish' ) continue;

					$product_link  = get_permalink( $pid );
					$product_image = wp_get_attachment_image_url( $product->get_image_id(), 'woocommerce_thumbnail' );
					$product_title = $product->get_name();
					$regular_price = $product->get_regular_price();
					$sale_price    = $product->get_sale_price();
					$weight        = $product->get_weight();
					$weight_text   = $weight ? $weight . 'г' : '';
					$is_liked      = function_exists( 'matreshka_is_in_wishlist' ) ? matreshka_is_in_wishlist( $pid ) : false;
					$like_icon     = $is_liked
						? get_template_directory_uri() . '/assets/icons/Heart.svg'
						: get_template_directory_uri() . '/assets/icons/like.svg';
				?>
				<div class="product-card" data-product-id="<?php echo esc_attr( $pid ); ?>">
					<a class="link-product" href="<?php echo esc_url( $product_link ); ?>">
						<div class="product-card-img">
							<?php echo matreshka_get_product_card_image_html( $product, $product_title ); ?>
						</div>
						<p class="montserrat-medium"><?php echo esc_html( $product_title ); ?></p>
						<?php if ( $weight_text ) : ?>
							<span class="montserrat-medium"><?php echo esc_html( $weight_text ); ?></span>
						<?php endif; ?>
					</a>
					<div class="product-card-bottom">
						<div class="product-card-price">
							<?php if ( $sale_price ) : ?>
								<h3 class="montserrat-bold text-red-primary">
									<?php echo matreshka_format_price( $sale_price, true, 'text-red-primary' ); ?>
								</h3>
								<span class="montserrat-semibold text-dark-opacity price-old"><?php echo matreshka_format_price( $regular_price ); ?></span>
							<?php else : ?>
								<h3 class="montserrat-bold">
									<?php echo matreshka_format_price( $regular_price ); ?>
								</h3>
							<?php endif; ?>
						</div>
						<img src="<?php echo esc_url( $like_icon ); ?>" alt="like" class="like-icon <?php echo $is_liked ? 'active' : ''; ?>">
					</div>
					<button class="btn w-100 btn-secondary montserrat-bold add-to-cart-btn"
							data-product_id="<?php echo esc_attr( $pid ); ?>"
							data-product_sku="<?php echo esc_attr( $product->get_sku() ); ?>">
						В корзину
					</button>
				</div>
				<?php endforeach; ?>
			</div>
		</div>
		<?php endif; ?>

		<!-- Back link -->
		<div class="promo-back">
			<a href="<?php echo esc_url( get_post_type_archive_link( 'promotion' ) ); ?>" class="btn btn-secondary montserrat-bold">
				<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/icons/AltArrowLeft.svg' ); ?>" alt="back" width="16" height="16" class="me-1">
				Все акции
			</a>
		</div>

	</div>
</main>

<script>
jQuery(function($){
	$('#promo-conditions-toggle').on('click', function(){
		var body = $(this).next('.promo-conditions-body');
		body.slideToggle(200);
		$(this).find('.promo-conditions-arrow').toggleClass('rotated');
	});
});
</script>

<?php
endwhile;
get_footer();

Youez - 2016 - github.com/yon3zu
LinuXploit