jetpack_social_menu_nav_menu_social_icons

Display SVG icons in social links menu.

Description

(string) jetpack_social_menu_nav_menu_social_icons( (string) $item_output, (WP_Post) $item, (int) $depth, (array) $args ); 

Returns (string)

$item_output The menu item output with social icon.

Parameters (4)

0. $item_output (string)
The menu item output.
1. $item (WP_Post)
Menu item object.
2. $depth (int)
Depth of the menu.
3. $args (array)
Wp_nav_menu() arguments.

Usage

  1. if ( !function_exists( 'jetpack_social_menu_nav_menu_social_icons' ) ) { 
  2. require_once '/modules/theme-tools/social-menu/icon-functions.php'; 
  3.  
  4. // The menu item output. 
  5. $item_output = ''; 
  6.  
  7. // Menu item object. 
  8. $item = null; 
  9.  
  10. // Depth of the menu. 
  11. $depth = -1; 
  12.  
  13. // wp_nav_menu() arguments. 
  14. $args = array(); 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = jetpack_social_menu_nav_menu_social_icons($item_output, $item, $depth, $args); 
  18.  

Defined (1)

The function is defined in the following location(s).

/modules/theme-tools/social-menu/icon-functions.php  
  1. function jetpack_social_menu_nav_menu_social_icons( $item_output, $item, $depth, $args ) { 
  2. // Get supported social icons. 
  3. $social_icons = jetpack_social_menu_social_links_icons(); 
  4.  
  5. // Change SVG icon inside social links menu if there is supported URL. 
  6. if ( 'jetpack-social-menu' === $args->theme_location ) { 
  7. foreach ( $social_icons as $attr => $value ) { 
  8. if ( false !== strpos( $item_output, $attr ) ) { 
  9. $item_output = str_replace( $args->link_after, '</span>' . jetpack_social_menu_get_svg( array( 'icon' => esc_attr( $value ) ) ), $item_output ); 
  10.  
  11. return $item_output;