jetpack_spotify_embed_ids

Turn text like this on it's own line into an embed: spotify:track:4bz7uB4edifWKJXSDxwHcs The core WordPress embed functionality only works with URLs Modified version of WP_Embed::autoembed().

Description

(string) jetpack_spotify_embed_ids( $content ); 

Returns (string)

Parameters (1)

0. $content
The content.

Usage

  1. if ( !function_exists( 'jetpack_spotify_embed_ids' ) ) { 
  2. require_once '/modules/shortcodes/spotify.php'; 
  3.  
  4. // The content. 
  5. $content = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_spotify_embed_ids($content); 
  9.  

Defined (1)

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

/modules/shortcodes/spotify.php  
  1. function jetpack_spotify_embed_ids( $content ) { 
  2. $textarr = wp_html_split( $content ); 
  3.  
  4. foreach ( $textarr as &$element ) { 
  5. if ( '' == $element || '<' === $element[0] ) { 
  6. continue; 
  7.  
  8. if ( substr( ltrim( $element ), 0, 8 ) !== 'spotify:' ) { 
  9. continue; 
  10.  
  11. $element = preg_replace_callback( '|^\s*(spotify:[^\s"]+:[^\s"]+)\s*$|im', 'jetpack_spotify_embed_ids_callback', $element ); 
  12.  
  13. return implode( '', $textarr );