function wpsight_options_social() { /** Check theme support of social options */ if (!current_theme_supports('options-social')) { return; } /** Create options array */ $options_social = array(); $options_social['heading_social'] = array('name' => __('Social', 'wpsight'), 'id' => 'heading_social', 'type' => 'heading'); /** Loop through social icons for info */ $social_icons = array(); foreach (wpsight_social_icons() as $k => $v) { $social_icons[$k] = '<img src="' . $v['icon'] . '" alt="" />'; } $social_icons = implode(' ', $social_icons); $options_social['icon_info'] = array('name' => __('Available Icons', 'wpsight'), 'desc' => $social_icons, 'type' => 'info'); /** Loop through social icons for icons and links */ $social_icons = array(); foreach (wpsight_social_icons() as $k => $v) { $social_icons[$k] = $v['name']; } array_unshift($social_icons, ''); $nr = apply_filters('wpsight_social_icons_nr', 5); for ($i = 1; $i <= $nr; $i++) { $std_icon = ''; $std_link = ''; /** Set first default to RSS */ if ($i == 1) { $std_icon = 'rss'; $std_link = get_bloginfo_rss('rss2_url'); } $options_social['icon_' . $i] = array('name' => __('Social', 'wpsight') . ' #' . $i . ' ' . __('Icon', 'wpsight'), 'desc' => __('Please select an icon.', 'wpsight'), 'std' => $std_icon, 'id' => 'icon_' . $i, 'type' => 'select', 'options' => $social_icons); $options_social['icon_' . $i . '_link'] = array('name' => __('Social', 'wpsight') . ' #' . $i . ' ' . __('Link', 'wpsight'), 'desc' => __('Please enter the URL to your social account.', 'wpsight'), 'std' => $std_link, 'id' => 'icon_' . $i . '_link', 'type' => 'text'); } return apply_filters('wpsight_options_social', $options_social); }
/** * Return specific social icon * * @since 1.0 */ function wpsight_get_social_icon($social_icon) { if (empty($social_icon)) { return; } $social_icons = wpsight_social_icons(); return $social_icons[$social_icon]; }