Сделал 1. Сделать пункты в "ТЗ Статья" 2. Сделать пункты в "ТЗ Хабовая страница" 3. Добавить микроразметку для статьи и блога https://docs.google.com/document/d/1ouFTKIXGk44hKONDDNWFGXBVqG06LWb7Jt28yFxklME/edit?tab=t.f4g9ytbmj2o8#heading=h.91km96rm8vln Reviewed-on: #1 Co-authored-by: WEB № 55 - Кирилл | Верстка <web_55@good-production.xyz>
26 lines
3.0 KiB
PHP
26 lines
3.0 KiB
PHP
<?php
|
|
$fields = $args['fields'] ?? [];
|
|
$attention = $fields['attention'] ?? 'red';
|
|
if (is_array($attention)) {
|
|
$attention = $attention['value'] ?? 'red';
|
|
}
|
|
$text = $fields['text'] ?? '';
|
|
$variants = [
|
|
'red' => ['class' => 'warning', 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="4" height="20" viewBox="0 0 4 20" fill="none"> <path d="M2.00001 1.90735e-06C2.56667 1.90735e-06 3.04201 0.192003 3.42601 0.576002C3.81001 0.960003 4.00134 1.43467 4 2V10C4 10.5667 3.808 11.0413 3.424 11.424C3.04 11.8067 2.56534 11.9987 2.00001 12C1.43467 12.0013 0.960007 11.8093 0.576007 11.424C0.192007 11.0387 6.89653e-06 10.564 6.89653e-06 10V2C6.89653e-06 1.43333 0.192007 0.958002 0.576007 0.574001C0.960007 0.190002 1.43467 -0.00133324 2.00001 1.90735e-06ZM2.00001 16C2.56667 16 3.04201 16.192 3.42601 16.576C3.81001 16.96 4.00134 17.4347 4 18C3.99867 18.5653 3.80667 19.04 3.424 19.424C3.04134 19.808 2.56667 20 2.00001 20C1.43334 20 0.958674 19.808 0.576007 19.424C0.193341 19.04 0.00134023 18.5653 6.89653e-06 18C-0.00132644 17.4347 0.190674 16.9593 0.576007 16.574C0.96134 16.1887 1.43601 15.9973 2.00001 16Z" fill="#E20A17"/> </svg>', 'title' => 'Важно!'],
|
|
'yellow' => ['class' => 'info', 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="4" height="20" viewBox="0 0 4 20" fill="none"> <path d="M2.00001 20C2.56667 20 3.04201 19.808 3.42601 19.424C3.81001 19.04 4.00134 18.5653 4 18V10C4 9.43333 3.808 8.95866 3.424 8.576C3.04 8.19333 2.56534 8.00133 2.00001 8C1.43467 7.99866 0.960007 8.19067 0.576007 8.576C0.192007 8.96133 6.89653e-06 9.436 6.89653e-06 10V18C6.89653e-06 18.5667 0.192007 19.042 0.576007 19.426C0.960007 19.81 1.43467 20.0013 2.00001 20ZM2.00001 4C2.56667 4 3.04201 3.808 3.42601 3.424C3.81001 3.04 4.00134 2.56533 4 2C3.99867 1.43467 3.80667 0.96 3.424 0.576C3.04134 0.192 2.56667 0 2.00001 0C1.43334 0 0.958674 0.192 0.576007 0.576C0.193341 0.96 0.00134023 1.43467 6.89653e-06 2C-0.00132644 2.56533 0.190674 3.04067 0.576007 3.426C0.96134 3.81133 1.43601 4.00267 2.00001 4Z" fill="#ED760E"/> </svg>', 'title' => 'Полезная информация'],
|
|
'green' => ['class' => 'success', 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="15" viewBox="0 0 20 15" fill="none"> <path d="M19.4672 0.532533C18.7571 -0.177511 17.6062 -0.177511 16.8962 0.532533L7.27259 10.1561L3.10355 5.98707C2.39351 5.27703 1.24258 5.27703 0.532533 5.98707C-0.177511 6.69712 -0.177511 7.84805 0.532533 8.55809L5.98707 14.0126C6.69713 14.7225 7.8481 14.7226 8.5581 14.0126L19.4672 3.10355C20.1772 2.39356 20.1771 1.24259 19.4672 0.532533Z" fill-rule="evenodd" clip-rule="evenodd" fill="#0D9D00"/> </svg>', 'title' => 'Рекомендация'],
|
|
];
|
|
$variant = $variants[$attention] ?? $variants['red'];
|
|
?>
|
|
|
|
<?php if ($text !== '') : ?>
|
|
<div class="h-attention h-attention--<?php echo esc_attr($variant['class']); ?>">
|
|
<div class="h-attention__icon">
|
|
<?php echo $variant['icon']; ?>
|
|
</div>
|
|
<div class="h-attention__content">
|
|
<?php echo wpautop(wp_kses_post($text)); ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|