Skip to content

Instantly share code, notes, and snippets.

View samjco's full-sized avatar

Sam C. samjco

View GitHub Profile
<?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",
@srikat
srikat / functions.php
Last active July 19, 2017 05:37
How to display Posts from a Category in columns using Display Posts Shortcode. https://sridharkatakam.com/how-to-display-posts-from-a-category-in-columns-using-display-posts-shortcode/
// 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"]
*
@RickeyMessick
RickeyMessick / Gravity Forms get all fields function
Created November 3, 2015 21:11
Gravity Forms get all fields function to use with gform_after_submission to display just filled out fields
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"]))
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active March 17, 2025 22:42
Example on how to export a Google sheet to various formats, includes most PDF options
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
@thierrypigot
thierrypigot / acf-missing.php
Created June 3, 2016 10:13
WordPress mu plugins to check if "Advanced Custom Fields Pro" is active.
<?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()
<?php
add_filter( 'caldera_forms_submission_url', function( $url, $form_id ){
if( 'CF582e6cf914f03' == $form_id ){
$url = 'https://somesite.com/api';
}
return $url;
}, 25, 2 );
@ensostyle
ensostyle / ListFieldRowTotal
Created January 11, 2017 12:15
Count the number of rows in a Gravity Forms list field and store the result in another field.
<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() {
<?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;
}
<?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 );
}
@Shelob9
Shelob9 / all-fields.php
Created May 2, 2017 19:09
Get all field IDs or field slugs or field labels from a Caldera Form
<?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 );