<?php
/*
Template Name: Шаблон страницы подписка на новости
*/
?>

<?php get_header();?>

<div class="content-middle articles-wrapper">
    <?php get_template_part('partials/rubrics-mobile'); ?>
    <div class="section-title subscription-section-title">
        <h1 class="section-title__title"><?=the_title()?></h1>
    </div>
    <div class="subscription-form">
        <div class="subscription-form__bg">
            <img src="<?= get_asset('/images/subscription_bg.png')?>" alt="" />
            <img src="<?= get_asset('/images/subscription_bg_sm.png')?>" alt="" />
        </div>
        <p class="subscription-form__title"><?the_content()?></p>
        <p class="subscription-form__subtitle">Выбор необходимых рубрик для подписки:</p>
        <div class="subscription-form__options">
            <?
            $arg_cat = array(
                'exclude' => '17,20, 21',
                'order' => 'ASC',
                'taxonomy' => 'category',
                'hide_empty' => false
            );
            $categories = get_categories($arg_cat);


            $firstElement = array_shift($categories);
            array_push($categories, $firstElement);
            foreach ($categories ?? [] as $key => $cat) {
            if ($cat->slug === 'uncategorized') continue;
            ?>
            <label class="checkbox">
                <input type="checkbox" name="<?=$cat->slug?>" form="custom_form" class="checkbox__input"/>
                <div class="checkbox__inner">
                    <div class="checkbox__check">
                        <img src="<?= get_asset('/icons/check.svg');?>" alt="#" />
                    </div>
                    <span><?=$cat->name?></span>
                </div>
            </label>
            <? } ?>
        </div>
      <?= do_shortcode('[contact-form-7 id="0ddb83c" title="Форма подписки" html_class="" html_id="custom_form"]')?>
        <? $privacyPolicy = get_field('privacy_policy', 'option'); ?>
        <p class="subscription-form__policy"><?= $privacyPolicy['output_text']?></p>
    </div>

    <a href="<?=home_url()?>" class="articles-preview__show-next subsctiption-back">На главную</a>
    <div class="grid">
        <div class="grid__item"></div>
        <div class="grid__item"></div>
    </div>
</div>

<style>
    .subscribe-form__btn {
        display: flex;
        align-items: center;
        text-align: center;
        justify-content: center;
        width: 275px;
    }
</style>

<?php get_footer();?>

