function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Social Media', THEME_NAME) : $instance['title'], $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <?php $listSocialMedia = array('apple', 'dribbble', 'facebook', 'flickr-2', 'forrst', 'github', 'google-drive', 'google-plus', 'instagram', 'linkedin', 'picassa', 'pinterest', 'feed-2', 'stackoverflow', 'stumbleupon', 'tumblr', 'twitter', 'vimeo', 'wordpress', 'yelp', 'youtube'); $optionData = array(); $output = ""; foreach ($listSocialMedia as $key => $sm) { $optionData[$sm]['socialmedia'] = theme_GetOption($sm . '_link'); $optionData[$sm]['header'] = theme_GetOption($sm . '_header'); $optionData[$sm]['widgets'] = theme_GetOption($sm . '_widgets'); } $output = "<ul class='clearfix'>"; foreach ($optionData as $key => $sm) { if ($sm['widgets'] === 'true') { if (isset($sm['socialmedia'])) { $output .= "<li><a class='icon-{$key}' href='{$sm['socialmedia']}'></a></li>"; } } } $output .= "</ul>"; echo $output; ?> <?php echo $after_widget; }
function socialmedia() { $listSocialMedia = array('apple', 'dribbble', 'facebook', 'flickr-2', 'forrst', 'github', 'google-drive', 'google-plus', 'instagram', 'linkedin', 'picassa', 'pinterest', 'feed-2', 'stackoverflow', 'stumbleupon', 'tumblr', 'twitter', 'vimeo', 'wordpress', 'yelp', 'youtube'); $optionData = array(); $output = ""; foreach ($listSocialMedia as $key => $sm) { $optionData[$sm]['socialmedia'] = theme_GetOption($sm . '_link'); $optionData[$sm]['header'] = theme_GetOption($sm . '_header'); $optionData[$sm]['widgets'] = theme_GetOption($sm . '_widgets'); } $output = "<div class='socialmedia-menu widget-social-media'><ul class='clearfix'>"; foreach ($optionData as $key => $sm) { if ($sm['header'] === 'true') { if (isset($sm['socialmedia'])) { $output .= "<li><a class='icon-{$key}' href='{$sm['socialmedia']}'></a></li>"; } } } $output .= "</ul></div>"; echo $output; }