/core.php

  1. <?php 
  2. /** 
  3. * Plugin Name: Caldera Custom Fields 
  4. * Plugin URI: https://CalderaWP.com/downloads/caldera-form-custom-fields 
  5. * Description: Create custom fields with powerful conditionals and processors using a Caldera Forms as the metabox designer. 
  6. * Version: 2.1.1 
  7. * Author: David Cramer for CalderaWP LLC 
  8. * Author URI: https://CalderaWP.com 
  9. * License: GPL-2.0+ 
  10. * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 
  11. */ 
  12.  
  13. define( 'CCF_PATH', plugin_dir_path( __FILE__ ) ); 
  14. define( 'CCF_URL', plugin_dir_url( __FILE__ ) ); 
  15. define( 'CCF_VER', '2.1.2' ); 
  16. define( 'CCF_CORE', __FILE__ ); 
  17.  
  18.  
  19. /** 
  20. * Load plugin 
  21. */ 
  22. add_action( 'init', 'cf_custom_fields_init' ); 
  23. function cf_custom_fields_init() { 
  24. include_once( CCF_PATH . '/includes/metabox.php' ); 
  25. include_once( CCF_PATH . '/includes/to-post-type.php' ); 
  26.  
  27. /** 
  28. * Get Caldera Forms 
  29. * 
  30. * Includes backwards compat for pre-Caldera Forms 1.3.4 
  31. * 
  32. * @since 2.0.5 
  33. * 
  34. * @return array|void 
  35. */ 
  36. function cf_custom_fields_get_forms() { 
  37. if ( class_exists( 'Caldera_Forms_Forms' ) ) { 
  38. $forms = Caldera_Forms_Forms::get_forms( true ); 
  39. } else { 
  40. $forms = Caldera_Forms::get_forms(); 
  41.  
  42. return $forms; 
  43.  
  44. /** 
  45. * Get Caldera Forms 
  46. * 
  47. * Includes backwards compat for pre-Caldera Forms 1.3.4 
  48. * 
  49. * @since 2.0.5 
  50. * 
  51. * @param string $id_name ID or name of form 
  52. * 
  53. * @return array|void 
  54. */ 
  55. function cf_custom_fields_get_form( $id_name ) { 
  56. if ( class_exists( 'Caldera_Forms_Forms' ) ) { 
  57. $form = Caldera_Forms_Forms::get_form( $id_name ); 
  58. } else { 
  59. $form = Caldera_Forms::get_form( $id_name ); 
  60.  
  61. if( isset( $form[ 'ID' ] ) && ! isset( $form[ 'id' ] ) ) { 
  62. $form[ 'id' ] = $form[ 'ID' ]; 
  63.  
  64. return $form; 
  65.  
.