Пример #1
0
    ?>
						</div>
						<div class="copy_socials socPage">
							<ul>
							<?php 
    $socials = get_theme_option('social_icons');
    foreach ($socials as $s) {
        if (empty($s['url'])) {
            continue;
        }
        $sn = basename($s['icon']);
        $sn = themerex_substr($sn, 0, themerex_strrpos($sn, '.'));
        if (($pos = themerex_strrpos($sn, '_')) !== false) {
            $sn = themerex_substr($sn, 0, $pos);
        }
        $soc = themerex_get_socials_url(basename($s['icon']));
        //$s['icon'];
        ?>
								<li><a class="social_icons social_<?php 
        echo $sn;
        ?>
" style="background-image: url(<?php 
        echo $soc;
        ?>
);" target="_blank" href="<?php 
        echo $s['url'];
        ?>
"><span style="background-image: url(<?php 
        echo $soc;
        ?>
);"></span></a></li>
Пример #2
0
 function showUserSocialLinks($args)
 {
     $args = array_merge(array('author_id' => 0, 'allowed' => array(), 'style' => 'bg', 'before' => '', 'after' => '', 'echo' => true), is_array($args) ? $args : array('author_id' => $args));
     // If send one number parameter - use it as author's ID
     global $THEMEREX_user_social_list;
     $output = '';
     if (count($args['allowed']) == 0) {
         $args['allowed'] = array_keys($THEMEREX_user_social_list);
     }
     foreach ($args['allowed'] as $s) {
         if (array_key_exists($s, $THEMEREX_user_social_list)) {
             $link = get_the_author_meta('user_' . $s, $args['author_id']);
             if ($link) {
                 $img = themerex_get_socials_url($s);
                 $output .= $args['before'] . '<a href="' . $link . '" class="social_icons social_' . esc_attr($s) . ' ' . 'icon-' . esc_attr($s) . '" target="_blank"' . '>' . '</a>' . $args['after'];
             }
         }
     }
     if ($args['echo']) {
         echo balanceTags($output);
     }
     return $output;
 }
Пример #3
0
function sc_team_item($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "user" => "", "name" => "", "position" => "", "photo" => "", "email" => "", "socials" => ""), $atts));
    global $THEMEREX_sc_team_counter, $THEMEREX_sc_team_count;
    $THEMEREX_sc_team_counter++;
    $descr = do_shortcode($content);
    if (!empty($user) && $user != 'none' && ($user_obj = get_user_by('login', $user)) != false) {
        $meta = get_user_meta($user_obj->ID);
        if (empty($email)) {
            $email = $user_obj->data->user_email;
        }
        if (empty($name)) {
            $name = $user_obj->data->display_name;
        }
        if (empty($position)) {
            $position = isset($meta['user_position'][0]) ? $meta['user_position'][0] : '';
        }
        if (empty($descr)) {
            $descr = isset($meta['description'][0]) ? $meta['description'][0] : '';
        }
        if (empty($socials)) {
            $socials = showUserSocialLinks(array('author_id' => $user_obj->ID, 'echo' => false, 'before' => '<li>', 'after' => '</li>'));
        }
    } else {
        //global $THEMEREX_user_social_list;
        $allowed = explode('|', $socials);
        $socials = '';
        for ($i = 0; $i < count($allowed); $i++) {
            $s = explode('=', $allowed[$i]);
            if (!empty($s[1])) {
                // && array_key_exists($s[0], $THEMEREX_user_social_list)) {
                $img = themerex_get_socials_url($s[0]);
                $socials .= '<li><a href="' . $s[1] . '" class="social_icons social_' . $s[0] . ' ' . $s[0] . '" target="_blank" style="background-image: url(' . $img . ');">' . '<span style="background-image: url(' . $img . ');"></span>' . '</a></li>';
            }
        }
    }
    if (empty($photo)) {
        if (!empty($email)) {
            $photo = get_avatar($email, 370);
        }
    } else {
        if ($photo > 0) {
            $attach = wp_get_attachment_image_src($photo, 'full');
            if (isset($attach[0]) && $attach[0] != '') {
                $photo = $attach[0];
            }
        }
        $photo = getResizedImageTag($photo, 370, 370);
    }
    if (!empty($name) && !empty($position)) {
        return '<div class="columns1_' . $THEMEREX_sc_team_count . (!empty($class) ? ' ' . $class : '') . '">' . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_team_item sc_team_item_' . $THEMEREX_sc_team_counter . ($THEMEREX_sc_team_counter % 2 == 1 ? ' odd' : ' even') . ($THEMEREX_sc_team_counter == 1 ? ' first' : '') . '">' . '<div class="sc_team_item_avatar">' . $photo . '<div class="sc_team_item_description">' . $descr . '</div>' . '</div>' . '<div class="sc_team_item_info">' . '<h3 class="sc_team_item_title">' . $name . '</h3>' . '<div class="sc_team_item_position theme_accent2">' . $position . '</div>' . (!empty($socials) ? '<ul class="sc_team_item_socials">' . $socials . '</ul>' : '') . '</div>' . '</div>' . '</div>';
    }
    return '';
}
Пример #4
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $text = isset($instance['text']) ? do_shortcode($instance['text']) : '';
        $logo_image = isset($instance['logo_image']) ? $instance['logo_image'] : '';
        $logo_text = isset($instance['logo_text']) ? $instance['logo_text'] : '';
        $show_logo = isset($instance['show_logo']) ? (int) $instance['show_logo'] : 1;
        $show_icons = isset($instance['show_icons']) ? (int) $instance['show_icons'] : 1;
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="widget_inner">
            <?php 
        if ($show_logo) {
            if ($logo_image == '') {
                $logo_image = get_custom_option('logo_image');
            }
            if ($logo_text == '') {
                $logo_text = get_custom_option('logo_text');
            }
            if ($logo_image != '' || $logo_text != '') {
                ?>
						<div class="logo"><a href="<?php 
                echo home_url();
                ?>
"><?php 
                echo $logo_image ? '<img src="' . $logo_image . '" alt="">' : '';
                echo $logo_text ? '<span class="logo_text">' . str_replace(array('[', ']'), array('<span class="theme_accent">', '</span>'), $logo_text) . '</span>' : '';
                ?>
</a></div>
					<?php 
            }
        }
        if (!empty($text)) {
            ?>
					<div class="logo_descr"><?php 
            echo nl2br(do_shortcode($text));
            ?>
</div>
                    <?php 
        }
        if ($show_icons) {
            $socials = get_theme_option('social_icons');
            ?>
					<div class="logo_socials socPage">
						<ul>
						<?php 
            foreach ($socials as $s) {
                if (empty($s['url'])) {
                    continue;
                }
                $sn = basename($s['icon']);
                $sn = themerex_substr($sn, 0, themerex_strrpos($sn, '.'));
                if (($pos = themerex_strrpos($sn, '_')) !== false) {
                    $sn = themerex_substr($sn, 0, $pos);
                }
                $soc = themerex_get_socials_url(basename($s['icon']));
                //$s['icon'];
                ?>
							<li><a class="social_icons social_<?php 
                echo $sn;
                ?>
" style="background-image: url(<?php 
                echo $soc;
                ?>
);" target="_blank" href="<?php 
                echo $s['url'];
                ?>
"><span style="background-image: url(<?php 
                echo $soc;
                ?>
);"></span></a></li>
							<?php 
            }
            ?>
						</ul>
					</div>
					<?php 
        }
        ?>
		</div>

		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }