This file contains 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 | |
/* | |
Plugin Name: Custom Caldera Forms Field | |
*/ | |
add_filter('caldera_forms_get_field_types', 'slug_add_field'); | |
function slug_add_field($fieldtypes){ | |
$fieldtypes['field_name'] = array( | |
"field" => "Field Name", |
This file contains 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
// Register a custom image size for Featured Category images | |
add_image_size( 'featured-cat-image', 300, 200, true ); | |
/** | |
* Add Column Classes to Display Posts Shortcodes | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcode | |
* | |
* Usage: [display-posts columns="2"] | |
* |
This file contains 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
function get_all_fields($entry, $form) | |
{ | |
//only do this for a certain form (id 53 for example) | |
// if ($form["id"] == 17) | |
//{ | |
foreach($form["fields"] as &$field) | |
{ | |
//see if this is a multi-field, like name or address | |
if (is_array($field["inputs"])) |
This file contains 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
function exportSpreadsheet() { | |
//All requests must include id in the path and a format parameter | |
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export | |
//FORMATS WITH NO ADDITIONAL OPTIONS | |
//format=xlsx //excel | |
//format=ods //Open Document Spreadsheet | |
//format=zip //html zipped | |
This file contains 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 | |
if( !class_exists('acf') ) | |
{ | |
$tp_acf_notice_msg = __( 'This website needs "Advanced Custom Fields Pro" to run. Please download and activate it', 'tp-notice-acf' ); | |
/* | |
* Admin notice | |
*/ | |
add_action( 'admin_notices', 'tp_notice_missing_acf' ); | |
function tp_notice_missing_acf() |
This file contains 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_submission_url', function( $url, $form_id ){ | |
if( 'CF582e6cf914f03' == $form_id ){ | |
$url = 'https://somesite.com/api'; | |
} | |
return $url; | |
}, 25, 2 ); |
This file contains 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
<script> | |
function ListFieldRowCount( listField, totalField ) { | |
var totalRows = jQuery( listField ).find('table.gfield_list tbody tr').length; | |
jQuery( totalField ).val( totalRows ).change(); | |
} | |
function ListFieldRowTotal( formId, fieldId, totalFieldId ) { | |
var listField = '#field_' + formId + '_' + fieldId; | |
var totalField = '#input_' + formId + '_' + totalFieldId; | |
ListFieldRowCount( listField, totalField ); | |
jQuery( listField ).on( 'click', '.add_list_item', function() { |
This file contains 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 | |
/** | |
* Get a field value and send to remote API | |
*/ | |
add_action( 'caldera_forms_submit_complete', function( $form, $referrer, $process_id ) { | |
//change your form ID here | |
if( 'cf123..' != $form[ 'ID' ] ) { | |
return; | |
} |
This file contains 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 | |
/** | |
* Delete all form configs, but no entries. | |
*/ | |
$forms = Caldera_Forms_Forms::get_forms( false, true ); | |
foreach ( $forms as $form ){ | |
Caldera_Forms_Forms::delete_form( $form ); | |
} |
This file contains 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 | |
/** | |
Get all field IDs or field slugs or field labels from a Caldera Form | |
*/ | |
//Get form config | |
$form = Caldera_Forms_Forms::get_form( 'CF58c1e0a4d7c27' ); | |
//Get all fields in order | |
$fields = Caldera_Forms_Forms::get_fields( $form, true ); |