twentythirteen_wpcom_instagram_oembed

Gets a medium size image instead of thumbnail when embedding images from Instagram with an embed or bare URL.

Description

(string) twentythirteen_wpcom_instagram_oembed( (string) $provider, (string) $url, (array) $args ); 

This currently fails because Instagram's minimum size for medium is 612, and Twenty Thirteen has 604 set as content_width.

Returns (string)

If Instagram isn't the provider or if image is smaller than required, or function call add_query_arg() to override maxwidth in the API call to get the medium size image.

Parameters (3)

0. $provider (string)
The provider.
1. $url (string)
Embedded URL.
2. $args (array)
Passed arguments for this oEmbed provider.

Usage

  1. if ( !function_exists( 'twentythirteen_wpcom_instagram_oembed' ) ) { 
  2. require_once '/inc/wpcom.php'; 
  3.  
  4. // The provider. 
  5. $provider = ''; 
  6.  
  7. // Embedded URL. 
  8. $url = ''; 
  9.  
  10. // Passed arguments for this oEmbed provider. 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = twentythirteen_wpcom_instagram_oembed($provider, $url, $args); 
  15.  

Defined (1)

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

/inc/wpcom.php  
  1. function twentythirteen_wpcom_instagram_oembed( $provider, $url, $args ) { 
  2. if ( 0 !== strpos( $provider, 'http://api.instagram.com/oembed' ) && $args['width'] < 612 ) 
  3. return $provider; 
  4.  
  5. return add_query_arg( 'maxwidth', 612, $provider );