View file root/template-parts/social-links.php

File size: 1.95Kb
<?php
/**
 * ****************************************************************************
 *
 *   НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ
 *
 *   ВНИМАНИЕ!!!!!!!
 *
 *   НЕ РЕДАКТИРУЙТЕ ЭТОТ ФАЙЛ
 *   ПРИ ОБНОВЛЕНИИ ТЕМЫ - ВЫ ПОТЕРЯЕТЕ ВСЕ ВАШИ ИЗМЕНЕНИЯ
 *   ИСПОЛЬЗУЙТЕ ДОЧЕРНЮЮ ТЕМУ ИЛИ НАСТРОЙКИ ТЕМЫ В АДМИНКЕ
 *
 *   ПОДБРОБНЕЕ:
 *   https://docs.wpshop.ru/child-themes/
 *
 * *****************************************************************************
 *
 * @package Root
 */


$is_show_social_js = 'yes' == root_get_option( 'structure_social_js' );

$social_profiles = array(
    'facebook',
    'vk',
    'twitter',
    'ok',
    'gp',
    'telegram',
    'youtube',
    'instagram',
    'linkedin',
);

foreach ( $social_profiles as $social_profile ) {
    if ( root_get_option( 'social_' . $social_profile ) ) {
        $social_profile_links[$social_profile] = root_get_option( 'social_' . $social_profile );
    }
}

if ( ! empty( $social_profile_links ) ) {

    ?>

<div class="social-links">
    <div class="social-buttons social-buttons--square social-buttons--circle social-buttons--small">

    <?php
        foreach ( $social_profiles as $social_profile ) {
            $social_profile_link = root_get_option( 'social_' . $social_profile );
            if ( ! empty( $social_profile_link ) ) {
                if ( $is_show_social_js ) {
                    echo '<span class="social-button social-button__'. $social_profile .' js-social-link" data-uri="' . esc_attr( $social_profile_link ) . '"></span>';
                } else {
                    echo '<a class="social-button social-button__'. $social_profile .'" href="' . esc_attr( $social_profile_link ) . '" target="_blank"></a>';
                }
            }
        }
    ?>

    </div>
</div>

<?php } ?>