27 lines
872 B
PHP
27 lines
872 B
PHP
<?php
|
|
$social_media = carbon_get_theme_option('social_media');
|
|
if (! is_array($social_media)) {
|
|
$social_media = array();
|
|
}
|
|
|
|
foreach ($social_media as $item) {
|
|
$icon = $item['social_media_img'] ?? '';
|
|
$link = $item['social_media_link'] ?? '';
|
|
if ('' === trim((string) $link)) {
|
|
continue;
|
|
}
|
|
|
|
|
|
$name = trim((string) ($item['social_media_name'] ?? ''));
|
|
if ('' === $name) {
|
|
$name = (string) preg_replace('#^www\.#', '', (string) wp_parse_url($link, PHP_URL_HOST));
|
|
}
|
|
if ('' === $name) {
|
|
$name = 'Соцсеть';
|
|
}
|
|
?>
|
|
<a class="social_item" href="<?php echo esc_url($link); ?>" title="<?php echo esc_attr($name); ?>" aria-label="<?php echo esc_attr($name); ?>">
|
|
<img loading="lazy" width="32" height="32" src="<?php echo esc_url(wp_get_attachment_url($icon)); ?>" alt="">
|
|
</a>
|
|
<?php } ?>
|