cf7_get_post_var

Insert a $post (Blog Post) Variable.

Description

cf7_get_post_var( $atts ); 

Parameters (1)

0. $atts
The atts.

Usage

  1. if ( !function_exists( 'cf7_get_post_var' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-dynamic-text-extension/contact-form-7-dynamic-text-extension.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = cf7_get_post_var($atts); 
  9.  

Defined (1)

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

/contact-form-7-dynamic-text-extension.php  
  1. function cf7_get_post_var($atts) { 
  2. extract(shortcode_atts(array( 
  3. 'key' => 'post_title',  
  4. ), $atts)); 
  5.  
  6. switch($key) { 
  7. case 'slug': 
  8. $key = 'post_name'; 
  9. break; 
  10. case 'title': 
  11. $key = 'post_title'; 
  12. break; 
  13.  
  14. global $post; 
  15. //echo '<pre>'; print_r($post); echo '</pre>'; 
  16. $val = $post->$key; 
  17. return $val;