cf_custom_fields_get_post_type_entry

Render saved entry when editing posts.

Description

(array) cf_custom_fields_get_post_type_entry( (array) $data, (array) $form, (string) $entry_id ); 

Returns (array)

Parameters (3)

0. $data (array)
Rendered data.
1. $form (array)
Form config.
2. $entry_id (string)
The entry id.

Usage

  1. if ( !function_exists( 'cf_custom_fields_get_post_type_entry' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-custom-fields/includes/to-post-type.php'; 
  3.  
  4. // Rendered data. 
  5. $data = array(); 
  6.  
  7. // Form config. 
  8. $form = array(); 
  9.  
  10. // The entry id. 
  11. $entry_id = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = cf_custom_fields_get_post_type_entry($data, $form, $entry_id); 
  15.  

Defined (2)

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

/includes/to-post-type.php  
  1. function cf_custom_fields_get_post_type_entry($data, $form, $entry_id) { 
  2.  
  3. if($processor = cf_custom_fields_has_pr_processor($form, $entry_id)) { 
  4. $fields = $form['fields']; 
  5.  
  6. $data = array(); 
  7. $data[$fields[$processor['config']['post_title']]['slug']] = $processor['post']->post_title; 
  8. unset($fields[$processor['config']['post_title']]); 
  9.  
  10. if(!empty($processor['config']['post_content'])) { 
  11. $data[$fields[$processor['config']['post_content']]['slug']] = $processor['post']->post_content; 
  12. unset($fields[$processor['config']['post_content']]); 
  13.  
  14.  
  15. foreach($fields as $field) { 
  16. $data[$field['slug']] = get_post_meta( $processor['post']->ID, $field['slug'], true ); 
  17. return $data; 
  1. function cf_custom_fields_get_post_type_entry($data, $form, $entry_id) { 
  2.  
  3. if($processor = cf_custom_fields_has_pr_processor($form, $entry_id)) { 
  4. $fields = $form['fields']; 
  5.  
  6. $data = array(); 
  7. $data[$fields[$processor['config']['post_title']]['slug']] = $processor['post']->post_title; 
  8. unset($fields[$processor['config']['post_title']]); 
  9.  
  10. if(!empty($processor['config']['post_content'])) { 
  11. $data[$fields[$processor['config']['post_content']]['slug']] = $processor['post']->post_content; 
  12. unset($fields[$processor['config']['post_content']]); 
  13.  
  14.  
  15. foreach($fields as $field) { 
  16. $data[$field['slug']] = get_post_meta( $processor['post']->ID, $field['slug'], true ); 
  17. return $data;