caldera_metaplate_shortcode

Renders the metaplace as a shortcode.

Description

(array|bool) caldera_metaplate_shortcode( (string) $atts, $content ); 

Returns (array|bool)

Returns the array for the metaplate or false if not found.

Parameters (2)

0. $atts (string)
The atts.
1. $content
The content.

Usage

  1. if ( !function_exists( 'caldera_metaplate_shortcode' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'metaplate/vendor/calderawp/metaplate-core/src/functions.php'; 
  3.  
  4. // The atts. 
  5. $atts = ''; 
  6.  
  7. // The content. 
  8. $content = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = caldera_metaplate_shortcode($atts, $content); 
  12.  

Defined (1)

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

/vendor/calderawp/metaplate-core/src/functions.php  
  1. function caldera_metaplate_shortcode( $atts, $content ) { 
  2. $atts = shortcode_atts( array( 
  3. 'id' => false,  
  4. 'slug' => false,  
  5. 'post_id' => false,  
  6. 'template_code' => false,  
  7. 'css' => false,  
  8. ), $atts, 'caldera_metaplate' ); 
  9.  
  10. if( $atts['id'] ) { 
  11. $metaplate = caldera_metaplate_get_metastack( $atts['id'] ); 
  12. }elseif ( !empty( $atts['slug'] ) ) { 
  13. $metaplate = caldera_metaplate_get_metastack( $atts['slug'] ); 
  14. }else{ 
  15. return; 
  16.  
  17.  
  18. if( ! is_array( $metaplate ) || empty( $metaplate ) ) { 
  19. return; 
  20.  
  21.  
  22. $render = new calderawp\metaplate\core\render(); 
  23. $output = $render->render_metaplate( $content, array( $metaplate ) ); 
  24. if ( is_string( $output ) ) { 
  25. return $output; 
  26.  
  27.