jetpack_getty_enable_embeds

Register Getty as oembed provider.

Description

jetpack_getty_enable_embeds( (string) $site = 'wpcom' ); 

Add filter to reverse iframes to shortcode. Register [getty] shortcode.

Parameters (1)

0. $site — Optional. (string) => 'wpcom'
Can be wpcom or jetpack and determines if we're in wpcom or in a Jetpack site.

Usage

  1. if ( !function_exists( 'jetpack_getty_enable_embeds' ) ) { 
  2. require_once '/modules/shortcodes/getty.php'; 
  3.  
  4. // Can be 'wpcom' or 'jetpack' and determines if we're in wpcom or in a Jetpack site. 
  5. $site = 'wpcom'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_getty_enable_embeds($site); 
  9.  

Defined (1)

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

/modules/shortcodes/getty.php  
  1. function jetpack_getty_enable_embeds( $site = 'wpcom' ) { 
  2.  
  3. // Set the caller argument to pass to Getty's oembed provider. 
  4. $caller = 'jetpack' === $site 
  5. ? parse_url( get_home_url(), PHP_URL_HOST ) 
  6. : 'wordpress.com'; 
  7.  
  8. // Support their oEmbed Endpoint 
  9. wp_oembed_add_provider( '#https?://www\.gettyimages\.com/detail/.*#i', "https://embed.gettyimages.com/oembed/?caller=$caller", true ); 
  10. wp_oembed_add_provider( '#https?://(www\.)?gty\.im/.*#i', "https://embed.gettyimages.com/oembed/?caller=$caller", true ); 
  11.  
  12. // Allow iframes to be filtered to short code (so direct copy+paste can be done) 
  13. add_filter( 'pre_kses', 'wpcom_shortcodereverse_getty' ); 
  14.  
  15. // Actually display the Getty Embed 
  16. add_shortcode( 'getty', 'jetpack_getty_shortcode' );