jetpack_site_icon_url

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

Description

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

Parameters (3)

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

Usage

  1. if ( !function_exists( 'jetpack_site_icon_url' ) ) { 
  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 = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = jetpack_site_icon_url($blog_id, $size, $default); 
  15.  

Defined (1)

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

/modules/site-icon/site-icon-functions.php  
  1. function jetpack_site_icon_url( $blog_id = null, $size = '512', $default = false ) { 
  2. $url = ''; 
  3. if( ! is_int( $blog_id ) ) 
  4. $blog_id = get_current_blog_id(); 
  5.  
  6. if( function_exists( 'get_blog_option' ) ) { 
  7. $site_icon_id = get_blog_option( $blog_id, 'jetpack_site_icon_id' ); 
  8. } else { 
  9. $site_icon_id = Jetpack_Options::get_option( 'site_icon_id' ); 
  10.  
  11. if( ! $site_icon_id ) { 
  12. if( $default === false && defined( 'SITE_ICON_DEFAULT_URL' ) ) 
  13. $url = SITE_ICON_DEFAULT_URL; 
  14. else 
  15. $url = $default; 
  16. } else { 
  17. if( $size >= 512 ) { 
  18. $size_data = 'full'; 
  19. } else { 
  20. $size_data = array( $size, $size ); 
  21. $url_data = wp_get_attachment_image_src( $site_icon_id, $size_data ); 
  22. $url = $url_data[0]; 
  23.  
  24. return $url;