promotion.php 1.66 KB
<?php
    $otdels = array();
    $cur_terms = get_the_terms( get_the_ID(), 'specializaciy' );
    if( is_array( $cur_terms ) )
        foreach( $cur_terms as $cur_term )
            $otdels[] = $cur_term->slug;
    unset($cur_terms);        
?>
<div class="promotions-wrap rounded-5 overflow-hidden row bg-white mb-4 flex-md-row-reverse"  data-slug="<?php echo implode(' ', $otdels); ?>">
    <div class="col-12 col-md-5 text-end mx-auto p-0">
        <?php
            if (has_post_thumbnail())
                the_post_thumbnail('promotions-thumbnails', array('class'=>'img-fluid', 'alt'=>get_the_title()));
        ?>
    </div>
    <div class="col-12 col-md-7 mx-auto p-0">
        <div class="d-flex h-100 flex-column justify-content-between">
            <div class="p-4">
                <h2 class="text-center text-md-start"><?php the_title(); ?></h2>
                <?php the_excerpt();//the_content(); ?>
                <?php 
                    $dateto = get_post_meta($post->ID, 'dateto', 1); 
                    if ($dateto!='')
                        echo '<div class="promotions-cal fw-500 ps-4 ps-md-0" data-icon="cal_1">'.$dateto.'</div>';
                    unset($dateto);
                ?>
            </div>
            <div class="pb-4 text-center text-md-start">
                <div class="promotions-price rounded-pill rounded-start text-center me-md-2"><span class="d-md-none">цена: </span><?php echo get_post_meta($post->ID, 'cost', 1); ?></div>
                <a class="btn fw-bold btn-default btn-style-2 border rounded-pill" href="<?php the_permalink();?>">Подробнее</a>
            </div>
        </div>
    </div>	
</div>
<?php
    unset($otdels);