jetpack_get_site_icon

The Jetpack by WordPress.com jetpack get site icon function.

Description

jetpack_get_site_icon( (constant) $blog_id = null, (string) $size = '512', (string) $default = '', (bool) $alt = false ); 

Parameters (4)

0. $blog_id — Optional. (constant) => null
The blog id.
1. $size — Optional. (string) => '512'
The size.
2. $default — Optional. (string) => ''
The default.
3. $alt — Optional. (bool) => false
The alt.

Usage

  1. if ( !function_exists( 'jetpack_get_site_icon' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/site-icon/site-icon-functions.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = null; 
  6.  
  7. // The size. 
  8. $size = '512'; 
  9.  
  10. // The default. 
  11. $default = ''; 
  12.  
  13. // The alt. 
  14. $alt = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = jetpack_get_site_icon($blog_id, $size, $default, $alt); 
  18.  

Defined (1)

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

/modules/site-icon/site-icon-functions.php  
  1. function jetpack_get_site_icon( $blog_id = null, $size = '512', $default = '', $alt = false ) { 
  2.  
  3. if( ! is_int( $blog_id ) ) 
  4. $blog_id = get_current_blog_id(); 
  5.  
  6. $size = esc_attr( $size ); 
  7. $class = "avatar avatar-$size"; 
  8. $alt = ( $alt ? esc_attr( $alt ) : __( 'Site Icon', jetpack ) ); 
  9. $src = esc_url( jetpack_site_icon_url( $blog_id, $size, $default ) ); 
  10. $avatar = "<img alt='{$alt}' src='{$src}' class='$class' height='{$size}' width='{$size}' />"; 
  11. /** 
  12. * Filters the display options for the Site Icon. 
  13. * @module site-icon 
  14. * @since 3.2.0 
  15. * @param string $avatar The Site Icon in an html image tag. 
  16. * @param int $blog_id The local site Blog ID. 
  17. * @param string $size The size of the Site Icon, default is 512. 
  18. * @param string $default The default URL for the Site Icon. 
  19. * @param string $alt The alt tag for the avatar. 
  20. */ 
  21. return apply_filters( 'jetpack-get_site_icon', $avatar, $blog_id, $size, $default, $alt );