jetpack_vr_viewer_shortcode

Convert [vr] shortcode to viewer.

Description

jetpack_vr_viewer_shortcode( $atts ); 

Shortcode example: [vr url="https://en-blog.files.wordpress.com/2016/12/regents_park.jpg" view="360"]

VR Viewer embed code:

Parameters (1)

0. $atts
The atts.

Usage

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

Defined (1)

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

/modules/shortcodes/vr.php  
  1. function jetpack_vr_viewer_shortcode( $atts ) { 
  2.  
  3. $params = shortcode_atts( array( 
  4. 0 => null,  
  5. 'url' => null,  
  6. 'src' => null,  
  7. 'guid' => null,  
  8. 'rotation' => null,  
  9. 'view' => null,  
  10. 'preview' => false,  
  11. ), $atts ); 
  12.  
  13. // We offer a few ways to specify the URL 
  14. if ( $params[0] ) { 
  15. $params['url'] = $params[0]; 
  16. } else if ( $params['src'] ) { 
  17. $params['url'] = $params['src']; 
  18.  
  19. $url_params = jetpack_vr_viewer_get_viewer_url_params( $params ); 
  20. if ( $url_params ) { 
  21. return jetpack_vr_viewer_get_html( $url_params ); 
  22.  
  23. // add check for user 
  24. if ( current_user_can( 'edit_posts' ) ) { 
  25. return '[vr] shortcode requires a data source to be given'; 
  26. } else { 
  27. return '';