how to force non-square font awesome social icons
-
I am using an Apex child theme on my blog. With the most recent update to Apex, I noticed that the social icons all use “square” versions of the default Font Awesome icons. I prefer the icons without the -square suffix, so I’m wondering what the cleanest, most efficient way to tell my theme to use them in place of the square ones might be. I found this code in Apex’s functions file:
// icons that should use a special square icon $square_icons = array('linkedin', 'twitter', 'vimeo', 'youtube', 'pinterest', 'reddit', 'tumblr', 'steam', 'xing', 'github', 'google-plus', 'behance', 'facebook');
and this bit, a few lines later:
// get the square or plain class if ( in_array( $active_site, $square_icons ) ) { $class = 'fa fa-' . $active_site . '-square'; } else { $class = 'fa fa-' . $active_site; }
but I’m not sure what I need to put in my child theme’s functions file to accomplish what I want to do.
In case it helps to see the above code in context, here’s the relevant section from the functions file:
// output social icons if( ! function_exists('ct_apex_social_icons_output') ) { function ct_apex_social_icons_output($source) { // get social sites array $social_sites = ct_apex_social_array(); // icons that should use a special square icon $square_icons = array('linkedin', 'twitter', 'vimeo', 'youtube', 'pinterest', 'reddit', 'tumblr', 'steam', 'xing', 'github', 'google-plus', 'behance', 'facebook'); // store the site name and url foreach ( $social_sites as $social_site => $profile ) { if ( strlen( get_theme_mod( $social_site ) ) > 0 ) { $active_sites[$social_site] = $social_site; } } // for each active social site, add it as a list item if ( ! empty( $active_sites ) ) { echo "<ul class='social-media-icons'>"; foreach ( $active_sites as $key => $active_site ) { // get the square or plain class if ( in_array( $active_site, $square_icons ) ) { $class = 'fa fa-' . $active_site . '-square'; } else { $class = 'fa fa-' . $active_site; } if ( $active_site == 'email' ) { ?> <li> <a class="email" target="_blank" href="mailto:<?php echo antispambot( is_email( get_theme_mod( $key ) ) ); ?>"> <i class="fa fa-envelope" title="<?php _e('email icon', 'apex'); ?>"></i> </a> </li> <?php } else { ?> <li> <a class="<?php echo $active_site; ?>" target="_blank" href="<?php echo esc_url( get_theme_mod( $key ) ); ?>"> <i class="<?php echo esc_attr( $class ); ?>" title="<?php printf( __('%s icon', 'apex'), $active_site ); ?>"></i> </a> </li> <?php } } echo "</ul>"; } } }
Any insight here would be greatly appreciated!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘how to force non-square font awesome social icons’ is closed to new replies.