jetpack_the_site_logo

Output an tag of the site logo, at the size specified in the theme's add_theme_support() declaration.

Description

jetpack_the_site_logo(); 

Usage

  1. if ( !function_exists( 'jetpack_the_site_logo' ) ) { 
  2. require_once '/core/third-party/site-logo/inc/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jetpack_the_site_logo(); 
  7.  

Defined (1)

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

/core/third-party/site-logo/inc/functions.php  
  1. function jetpack_the_site_logo() { 
  2. $logo =site_logo)->logo; 
  3. $logo_id = get_theme_mod( 'custom_logo' ); // Check for WP 4.5 Site Logo 
  4. $logo_id = $logo_id ? $logo_id : $logo['id']; // Use WP Core logo if present, otherwise use Jetpack's. 
  5. $size =site_logo)->theme_size(); 
  6. $html = ''; 
  7.  
  8. // If no logo is set, but we're in the Customizer, leave a placeholder (needed for the live preview). 
  9. if ( ! jetpack_has_site_logo() ) { 
  10. $html = sprintf( '<a href="%1$s" class="site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>',  
  11. esc_url( home_url( '/' ) ),  
  12. esc_attr( $size ) 
  13. ); 
  14.  
  15. // We have a logo. Logo is go. 
  16. else { 
  17. $html = sprintf( '<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>',  
  18. esc_url( home_url( '/' ) ),  
  19. wp_get_attachment_image( 
  20. $logo_id,  
  21. $size,  
  22. false,  
  23. array( 
  24. 'class' => "site-logo attachment-$size",  
  25. 'data-size' => $size,  
  26. 'itemprop' => "logo" 
  27. ); 
  28.  
  29. /** 
  30. * Filter the Site Logo output. 
  31. * @module theme-tools 
  32. * @since 3.2.0 
  33. * @param string $html Site Logo HTML output. 
  34. * @param array $logo Array of Site Logo details. 
  35. * @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default. 
  36. */ 
  37. echo apply_filters( 'jetpack_the_site_logo', $html, $logo, $size );