Skip to content

Instantly share code, notes, and snippets.

@juanfra
Created July 4, 2017 21:27
Show Gist options
  • Save juanfra/70e913437d86ddf3c6e2bd8e7d879a09 to your computer and use it in GitHub Desktop.
Save juanfra/70e913437d86ddf3c6e2bd8e7d879a09 to your computer and use it in GitHub Desktop.
Add [social_icons] to include all icons on the top bar
<?php
//* Do NOT include the opening php tag
if ( ! function_exists( 'nice_top_bar_social_shortcode' ) ) :
add_filter( 'nice_top_bar_shortcodes', 'nice_top_bar_social_shortcode' );
/**
* Add shortcodes to top bar.
*
* @since 1.0.2
*
* @param array $shortcodes
*
* @return array
*/
function nice_top_bar_social_shortcode( array $shortcodes = array() ) {
$shortcodes['social_icons'] = 'nice_social_links_shortcode';
return $shortcodes;
}
endif;
if ( ! function_exists( 'nice_social_links_shortcode' ) ) :
/**
* Manage [social_icons] shortcode on top bar.
*
* @since 1.0.2
*/
function nice_social_links_shortcode() {
return nice_social_links( array(
'section' => 'top-bar',
'echo' => false,
'show_always' => false,
'before' => '<div class="social-icons">',
'after' => '</div>',
)
);
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment