This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply the new columns order in Csv attached to email and CSV stored in admin | |
*/ | |
add_filter( 'caldera_forms_email_csv_data', 'cf_reorder_csv_columns', 10, 2 ); | |
add_filter( 'caldera_forms_admin_csv', 'cf_reorder_csv_columns', 10, 2 ); | |
/** | |
* Reorder columns in Caldera Forms generated CSV file | |
*/ | |
function cf_reorder_csv_columns( $csv_data, $form ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove a field from the entry saved in the DB without removing it from the emails | |
*/ | |
add_action( 'caldera_forms_submit_complete',function( $form, $referrer, $process_id, $entryid ){ | |
unset( $form['fields']['fld_8768091'] ); | |
Caldera_Forms_Save_Final::save_in_db( $form, $entryid ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change which Pods field is used for the label of a Caldera Forms field autopopulated with the results of an Easy Pods for a specific Easy Pod. | |
*/ | |
add_filter( 'caldera_forms_easy_pods_autopopulate_label_field', function( $label_field ){ | |
$label_field = 'post_title'; | |
return $label_field; | |
}, 10 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'the_content', function() { | |
//Replace the number with the page ID to display entries on | |
if ( is_page('2' ) ) { | |
require_once( CFCORE_PATH . 'classes/admin.php' ); | |
//Be sure to set the correct form ID below | |
$form_id = 'CF5a5e8452c6f82'; | |
//get all entires (page 1 with 9999999 entries per page should do it:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This function is copied from https://wpscholar.com/blog/get-attachment-id-from-wp-image-url/ | |
* | |
* Function to get the attachment ID of a media file based on its URL in WordPress | |
* | |
*/ | |
function get_attachment_id( $url ) { | |
$attachment_id = 0; | |
$dir = wp_upload_dir(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'caldera_forms_submit_post_process', function( $form, $referrer, $process_id, $entry_id ){ | |
//make sure to set your field ID here. | |
$field_id = 'fld_123456'; | |
//Get value of a field | |
$field_value = Caldera_Forms::get_field_data( $field_id, $form , $entry_id); | |
//check value | |
if( in_array( $field_value, array( 'Roy', 'Shawn' )) ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('the_content', function( $content ) { | |
//Replace 1 with the page ID you want to test in and the custom_field_name with your own | |
$page_id = '1'; | |
$key = 'custom_field_name'; | |
if( is_page( $page_id ) ) { | |
var_dump( get_post_meta( $page_id, $key) ); | |
} | |
return $content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_pro_get_public_key', function(){ | |
return '0000-0000-000000000-0000'; | |
}); | |
add_filter( 'caldera_forms_pro_get_secret_key', function(){ | |
return '0000-0000-000000000-0000'; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_mailer', function( $mail, $data, $form ) { | |
//MAKE SURE TO CHANGE FORM ID | |
if( "CF5a5e8452c6f82" == $form[ 'ID' ] ) { | |
//If Pro NOT activated | |
$mail[ 'replyto' ] = $mail[ 'recipients' ]; | |
//IF Pro Activated | |
//$mail[ 'from' ] = $mail[ 'recipients' ]; | |
} | |
return $mail; |