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 | |
function add_custom_query_vars($vars) { | |
$vars[] = "past_events"; | |
return $vars; | |
} | |
// hook add_query_vars function into query_vars | |
add_filter('query_vars', 'add_custom_query_vars'); |
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 | |
global $current_user; // Use global | |
get_currentuserinfo(); // Make sure global is set, if not set it. | |
if ( user_can( $current_user, "subscriber" ) ) { | |
// Disable admin bar for subscribers | |
show_admin_bar(false); |
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
// Turns all textareas into medium-editors | |
// requires: | |
// - Medium-Editor | |
// - jQuery (can be easily rewritten without) | |
// - find_with_mutations: https://gist.github.com/hampei/7620643 | |
// - sync_node_html_to_form_field: https://gist.github.com/hampei/7620825 | |
window.textareas_to_medium_editor = function() { | |
find_with_mutations('form', 'textarea', function(el) { | |
el.style.display = 'none'; // hide the textarea | |
editor = $('<div />'); // create editor element |
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
<?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 | |
/** | |
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 ); |
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 | |
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
<?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", |
OlderNewer