Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › Add Font Awesome Icon to Social Media Header
New Landing › How can we help? › Themeforest Theme Support › Dante › Add Font Awesome Icon to Social Media Header
- This topic has 20 replies, 4 voices, and was last updated 10 years by Mohammad – SUPPORT.
-
Posted in: Dante
-
February 28, 2014 at 1:46 am #52718
I’d like to add the font awesome phone icon to the right of the social media icons in the header and have it link to the contact page.
This is what I’ve got so far on my dev site:
http://jspigner.pairserver.comI’d like the phone to be the same size as the social media icons, have a similar hover effect and be placed to the right of the social media icons.
Please let me know if this is possible without customizations.
Thanks so much!
February 28, 2014 at 6:48 am #52736Hi,
Please open to edit shortcodes.php at /dante/swift-framework/Find this code at line 758 - 760 if ($id == "xing") { $social_icons .= '<li class="xing"><a href="'.$xing.'" target="_blank"><i class="fa-xing"></i><i class="fa-xing"></i></a></li>'."\n"; } and put this code after these lines $social_icons .= '<li class="phone"><a href="http://jspigner.pairserver.com/contact-us/" target="_blank"><i class="fa-phone"></i><i class="fa-phone"></i></a></li>'."\n";
It will make your desire change .
Thanks
With Best Regards
Swift IdeasFebruary 28, 2014 at 6:50 pm #53051Thanks so much for the super quick reply!
This almost worked however it added two phone icons to the right of each of my social media icons. But you sent me in the right direction and I was able to configure it exactly how I wanted it.
Since I’ve now made changes to the shortcodes file, will these be lost if I update the theme? Will using a child theme save these if I update?
Thanks so much for your help!!!
Kimley
March 1, 2014 at 2:00 am #53083Hi,
You most welcome .I amglad that issue fixed . Please activate your child theme and put this code functions.php at /wp-content/themes/dante-child/ . So you can keep this after update .
/* SOCIAL SHORTCODE
================================================= */
if (!function_exists(‘sf_social_icons’)) {
function sf_social_icons($atts, $content = null) {
extract(shortcode_atts(array(
“type” => ”,
“size” => ‘standard’,
“style” => ”
), $atts));$options = get_option(‘sf_dante_options’);
$twitter = $options[‘twitter_username’];
$facebook = $options[‘facebook_page_url’];
$dribbble = $options[‘dribbble_username’];
$vimeo = $options[‘vimeo_username’];
$tumblr = $options[‘tumblr_username’];
$skype = $options[‘skype_username’];
$linkedin = $options[‘linkedin_page_url’];
$googleplus = $options[‘googleplus_page_url’];
$flickr = $options[‘flickr_page_url’];
$youtube = $options[‘youtube_url’];
$pinterest = $options[‘pinterest_username’];
$foursquare = $options[‘foursquare_url’];
$instagram = $options[‘instagram_username’];
$github = $options[‘github_url’];
$xing = $options[‘xing_url’];$social_icons = ”;
if ($type == ”) {
if ($twitter) {
$social_icons .= ‘<li class=”twitter”><i class=”fa-twitter”></i><i class=”fa-twitter”></i>‘.”\n”;
}
if ($facebook) {
$social_icons .= ‘<li class=”facebook”><i class=”fa-facebook”></i><i class=”fa-facebook”></i>‘.”\n”;
}
if ($dribbble) {
$social_icons .= ‘<li class=”dribbble”><i class=”fa-dribbble”></i><i class=”fa-dribbble”></i>‘.”\n”;
}
if ($youtube) {
$social_icons .= ‘<li class=”youtube”><i class=”fa-youtube”></i><i class=”fa-youtube”></i>‘.”\n”;
}
if ($vimeo) {
$social_icons .= ‘<li class=”vimeo”><i class=”fa-vimeo-square”></i><i class=”fa-vimeo-square”></i>‘.”\n”;
}
if ($tumblr) {
$social_icons .= ‘<li class=”tumblr”><i class=”fa-tumblr”></i><i class=”fa-tumblr”></i>‘.”\n”;
}
if ($skype) {
$social_icons .= ‘<li class=”skype”><i class=”fa-skype”></i><i class=”fa-skype”></i>‘.”\n”;
}
if ($linkedin) {
$social_icons .= ‘<li class=”linkedin”><i class=”fa-linkedin”></i><i class=”fa-linkedin”></i>‘.”\n”;
}
if ($googleplus) {
$social_icons .= ‘<li class=”googleplus”><i class=”fa-google-plus”></i><i class=”fa-google-plus”></i>‘.”\n”;
}
if ($flickr) {
$social_icons .= ‘<li class=”flickr”><i class=”fa-flickr”></i><i class=”fa-flickr”></i>‘.”\n”;
}
if ($pinterest) {
$social_icons .= ‘<li class=”pinterest”><i class=”fa-pinterest”></i><i class=”fa-pinterest”></i>‘.”\n”;
}
if ($foursquare) {
$social_icons .= ‘<li class=”foursquare”><i class=”fa-foursquare”></i><i class=”fa-foursquare”></i>‘.”\n”;
}
if ($instagram) {
$social_icons .= ‘<li class=”instagram”><i class=”fa-instagram”></i><i class=”fa-instagram”></i>‘.”\n”;
}
if ($github) {
$social_icons .= ‘<li class=”github”><i class=”fa-github”></i><i class=”fa-github”></i>‘.”\n”;
}
if ($xing) {
$social_icons .= ‘<li class=”xing”><i class=”fa-xing”></i><i class=”fa-xing”></i>‘.”\n”;
}
} else {$social_type = explode(‘,’, $type);
foreach ($social_type as $id) {
if ($id == “twitter”) {
$social_icons .= ‘<li class=”twitter”><i class=”fa-twitter”></i><i class=”fa-twitter”></i>‘.”\n”;
}
if ($id == “facebook”) {
$social_icons .= ‘<li class=”facebook”><i class=”fa-facebook”></i><i class=”fa-facebook”></i>‘.”\n”;
}
if ($id == “dribbble”) {
$social_icons .= ‘<li class=”dribbble”><i class=”fa-dribbble”></i><i class=”fa-dribbble”></i>‘.”\n”;
}
if ($id == “youtube”) {
$social_icons .= ‘<li class=”youtube”><i class=”fa-youtube”></i><i class=”fa-youtube”></i>‘.”\n”;
}
if ($id == “vimeo”) {
$social_icons .= ‘<li class=”vimeo”><i class=”fa-vimeo-square”></i><i class=”fa-vimeo-square”></i>‘.”\n”;
}
if ($id == “tumblr”) {
$social_icons .= ‘<li class=”tumblr”><i class=”fa-tumblr”></i><i class=”fa-tumblr”></i>‘.”\n”;
}
if ($id == “skype”) {
$social_icons .= ‘<li class=”skype”><i class=”fa-skype”></i><i class=”fa-skype”></i>‘.”\n”;
}
if ($id == “linkedin”) {
$social_icons .= ‘<li class=”linkedin”><i class=”fa-linkedin”></i><i class=”fa-linkedin”></i>‘.”\n”;
}
if ($id == “googleplus” || $id == “google-plus” || $id == “google+”) {
$social_icons .= ‘<li class=”googleplus”><i class=”fa-google-plus”></i><i class=”fa-google-plus”></i>‘.”\n”;
}
if ($id == “flickr”) {
$social_icons .= ‘<li class=”flickr”><i class=”fa-flickr”></i><i class=”fa-flickr”></i>‘.”\n”;
}
if ($id == “pinterest”) {
$social_icons .= ‘<li class=”pinterest”><i class=”fa-pinterest”></i><i class=”fa-pinterest”></i>‘.”\n”;
}
if ($id == “foursquare”) {
$social_icons .= ‘<li class=”foursquare”><i class=”fa-foursquare”></i><i class=”fa-foursquare”></i>‘.”\n”;
}
if ($id == “instagram”) {
$social_icons .= ‘<li class=”instagram”><i class=”fa-instagram”></i><i class=”fa-instagram”></i>‘.”\n”;
}
if ($id == “github”) {
$social_icons .= ‘<li class=”github”><i class=”fa-github”></i><i class=”fa-github”></i>‘.”\n”;
}
if ($id == “xing”) {
$social_icons .= ‘<li class=”xing”><i class=”fa-xing”></i><i class=”fa-xing”></i>‘.”\n”;
}$social_icons .= ‘<li class=”phone”><i class=”fa-phone”></i><i class=”fa-phone”></i>‘.”\n”;
}
}$output = ‘<ul class=”social-icons ‘.$size.’ ‘.$style.'”>’.”\n”;
$output .= $social_icons;
$output .= ‘‘.”\n”;return $output;
}
add_shortcode(“social”, “sf_social_icons”);
}March 1, 2014 at 2:01 am #53084Hi,
You most welcome .I amglad that issue fixed . Please activate your child theme and put this code functions.php at /wp-content/themes/dante-child/ . So you can keep this after update ./* SOCIAL SHORTCODE ================================================= */ if (!function_exists('sf_social_icons')) { function sf_social_icons($atts, $content = null) { extract(shortcode_atts(array( "type" => '', "size" => 'standard', "style" => '' ), $atts)); $options = get_option('sf_dante_options'); $twitter = $options['twitter_username']; $facebook = $options['facebook_page_url']; $dribbble = $options['dribbble_username']; $vimeo = $options['vimeo_username']; $tumblr = $options['tumblr_username']; $skype = $options['skype_username']; $linkedin = $options['linkedin_page_url']; $googleplus = $options['googleplus_page_url']; $flickr = $options['flickr_page_url']; $youtube = $options['youtube_url']; $pinterest = $options['pinterest_username']; $foursquare = $options['foursquare_url']; $instagram = $options['instagram_username']; $github = $options['github_url']; $xing = $options['xing_url']; $social_icons = ''; if ($type == '') { if ($twitter) { $social_icons .= '<li class="twitter"><a href="http://www.twitter.com/'.$twitter.'" target="_blank"><i class="fa-twitter"></i><i class="fa-twitter"></i></a></li>'."\n"; } if ($facebook) { $social_icons .= '<li class="facebook"><a href="'.$facebook.'" target="_blank"><i class="fa-facebook"></i><i class="fa-facebook"></i></a></li>'."\n"; } if ($dribbble) { $social_icons .= '<li class="dribbble"><a href="http://www.dribbble.com/'.$dribbble.'" target="_blank"><i class="fa-dribbble"></i><i class="fa-dribbble"></i></a></li>'."\n"; } if ($youtube) { $social_icons .= '<li class="youtube"><a href="'.$youtube.'" target="_blank"><i class="fa-youtube"></i><i class="fa-youtube"></i></a></li>'."\n"; } if ($vimeo) { $social_icons .= '<li class="vimeo"><a href="http://www.vimeo.com/'.$vimeo.'" target="_blank"><i class="fa-vimeo-square"></i><i class="fa-vimeo-square"></i></a></li>'."\n"; } if ($tumblr) { $social_icons .= '<li class="tumblr"><a href="http://'.$tumblr.'.tumblr.com/" target="_blank"><i class="fa-tumblr"></i><i class="fa-tumblr"></i></a></li>'."\n"; } if ($skype) { $social_icons .= '<li class="skype"><a href="skype:'.$skype.'" target="_blank"><i class="fa-skype"></i><i class="fa-skype"></i></a></li>'."\n"; } if ($linkedin) { $social_icons .= '<li class="linkedin"><a href="'.$linkedin.'" target="_blank"><i class="fa-linkedin"></i><i class="fa-linkedin"></i></a></li>'."\n"; } if ($googleplus) { $social_icons .= '<li class="googleplus"><a href="'.$googleplus.'" target="_blank"><i class="fa-google-plus"></i><i class="fa-google-plus"></i></a></li>'."\n"; } if ($flickr) { $social_icons .= '<li class="flickr"><a href="'.$flickr.'" target="_blank"><i class="fa-flickr"></i><i class="fa-flickr"></i></a></li>'."\n"; } if ($pinterest) { $social_icons .= '<li class="pinterest"><a href="http://www.pinterest.com/'.$pinterest.'/" target="_blank"><i class="fa-pinterest"></i><i class="fa-pinterest"></i></a></li>'."\n"; } if ($foursquare) { $social_icons .= '<li class="foursquare"><a href="'.$foursquare.'" target="_blank"><i class="fa-foursquare"></i><i class="fa-foursquare"></i></a></li>'."\n"; } if ($instagram) { $social_icons .= '<li class="instagram"><a href="http://instagram.com/'.$instagram.'" target="_blank"><i class="fa-instagram"></i><i class="fa-instagram"></i></a></li>'."\n"; } if ($github) { $social_icons .= '<li class="github"><a href="'.$github.'" target="_blank"><i class="fa-github"></i><i class="fa-github"></i></a></li>'."\n"; } if ($xing) { $social_icons .= '<li class="xing"><a href="'.$xing.'" target="_blank"><i class="fa-xing"></i><i class="fa-xing"></i></a></li>'."\n"; } } else { $social_type = explode(',', $type); foreach ($social_type as $id) { if ($id == "twitter") { $social_icons .= '<li class="twitter"><a href="http://www.twitter.com/'.$twitter.'" target="_blank"><i class="fa-twitter"></i><i class="fa-twitter"></i></a></li>'."\n"; } if ($id == "facebook") { $social_icons .= '<li class="facebook"><a href="'.$facebook.'" target="_blank"><i class="fa-facebook"></i><i class="fa-facebook"></i></a></li>'."\n"; } if ($id == "dribbble") { $social_icons .= '<li class="dribbble"><a href="http://www.dribbble.com/'.$dribbble.'" target="_blank"><i class="fa-dribbble"></i><i class="fa-dribbble"></i></a></li>'."\n"; } if ($id == "youtube") { $social_icons .= '<li class="youtube"><a href="'.$youtube.'" target="_blank"><i class="fa-youtube"></i><i class="fa-youtube"></i></a></li>'."\n"; } if ($id == "vimeo") { $social_icons .= '<li class="vimeo"><a href="http://www.vimeo.com/'.$vimeo.'" target="_blank"><i class="fa-vimeo-square"></i><i class="fa-vimeo-square"></i></a></li>'."\n"; } if ($id == "tumblr") { $social_icons .= '<li class="tumblr"><a href="http://'.$tumblr.'.tumblr.com/" target="_blank"><i class="fa-tumblr"></i><i class="fa-tumblr"></i></a></li>'."\n"; } if ($id == "skype") { $social_icons .= '<li class="skype"><a href="skype:'.$skype.'" target="_blank"><i class="fa-skype"></i><i class="fa-skype"></i></a></li>'."\n"; } if ($id == "linkedin") { $social_icons .= '<li class="linkedin"><a href="'.$linkedin.'" target="_blank"><i class="fa-linkedin"></i><i class="fa-linkedin"></i></a></li>'."\n"; } if ($id == "googleplus" || $id == "google-plus" || $id == "google+") { $social_icons .= '<li class="googleplus"><a href="'.$googleplus.'" target="_blank"><i class="fa-google-plus"></i><i class="fa-google-plus"></i></a></li>'."\n"; } if ($id == "flickr") { $social_icons .= '<li class="flickr"><a href="'.$flickr.'" target="_blank"><i class="fa-flickr"></i><i class="fa-flickr"></i></a></li>'."\n"; } if ($id == "pinterest") { $social_icons .= '<li class="pinterest"><a href="http://www.pinterest.com/'.$pinterest.'/" target="_blank"><i class="fa-pinterest"></i><i class="fa-pinterest"></i></a></li>'."\n"; } if ($id == "foursquare") { $social_icons .= '<li class="foursquare"><a href="'.$foursquare.'" target="_blank"><i class="fa-foursquare"></i><i class="fa-foursquare"></i></a></li>'."\n"; } if ($id == "instagram") { $social_icons .= '<li class="instagram"><a href="http://instagram.com/'.$instagram.'" target="_blank"><i class="fa-instagram"></i><i class="fa-instagram"></i></a></li>'."\n"; } if ($id == "github") { $social_icons .= '<li class="github"><a href="'.$github.'" target="_blank"><i class="fa-github"></i><i class="fa-github"></i></a></li>'."\n"; } if ($id == "xing") { $social_icons .= '<li class="xing"><a href="'.$xing.'" target="_blank"><i class="fa-xing"></i><i class="fa-xing"></i></a></li>'."\n"; } $social_icons .= '<li class="phone"><a href="http://jspigner.pairserver.com/contact-us/" target="_blank"><i class="fa-phone"></i><i class="fa-phone"></i></a></li>'."\n"; } } $output = '<ul class="social-icons '.$size.' '.$style.'">'."\n"; $output .= $social_icons; $output .= '</ul>'."\n"; return $output; } add_shortcode("social", "sf_social_icons"); }
With Best Regards
Swift IdeasMarch 1, 2014 at 11:14 pm #53188Great! Thanks so much again for all your help!
Kimley
March 3, 2014 at 11:42 am #53473Great! 🙂
April 2, 2014 at 3:04 pm #63815Ok,I have the same question (wanting to add another icon in the social icon header) but I haven’t figured out how to change the code to add just ONE single icon instead of one icon after every social icons
the code that was posted above:
$social_icons .= '<li class="envelope"><a href=".../contact-us/" target="_blank"><i class="fa-envelope"></i><i class="fa-envelope"></i></a></li>'."\n";
returns a page result of *twitter icon* *envelope icon* *facebook icon* *envelope icon* *github icon* *envelope icon* *youtube icon* *envelope icon* *flickr icon* *envelope icon*
instead of the desired look of adding just the ONE icon at the end of the string.
And my mucking about in the shortcodes.php trying to decipher how to change the above code isn’t working.
How do I modify the code to add an additional icon in that row?
thanksApril 2, 2014 at 3:40 pm #63830Hi,
You used right code as i see . Please provide your website URl so i can check .Thanks
April 2, 2014 at 4:02 pm #63841I’m building this on a test server so I can’t share – I *only* added the extra code to the shortcodes.php file. Attaching a screen shot.
April 2, 2014 at 4:13 pm #63849Hi,
Where and how many times you added this code ?
$social_icons .= '<li class="envelope"><a href=".../contact-us/" target="_blank"><i class="fa-envelope"></i><i class="fa-envelope"></i></a></li>'."\n";
Please attach shortcodes.php as zip so i can correct your code .Thanks
April 2, 2014 at 4:36 pm #63861As I previously posted:
I *only* added the extra code to the shortcodes.php file.
I didn’t touch any other file. I followed the directions you posted above in reply #52736 and added the code to the shortcodes.php page
dante/swift-framwork/shortcodes.php
April 2, 2014 at 4:45 pm #63870Hi tracytracy,
I had the same issue that you’re having. I altered the code as follows (obviously change your link and the icon you wish to use):
if ($id == "phone") { $social_icons .= '<li class="phone"><a href="http://www.visionfirst.com/contact-us/"><i class="fa-phone"></i><i class="fa-phone"></i></a></li>'."\n"; }
Let me know if you need any further clarification. Hope that helps!
Kimley
April 2, 2014 at 4:48 pm #63874@tracytracy – please attach your shortcodes so i can check in detail .
ThanksApril 2, 2014 at 4:58 pm #63880Kimley – Thanks, but just copy&pasting that code exactly just changes my results to having four little phone icons in the header instead of 4 little envelopes 😉 Obviously there is a key here that I’m missing.
Is there more than this single step involved when wanting to add additional icons into the top header bar along side the social media icons?
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.