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 | |
/** | |
* Define the directory with the font via fontDir configuration key. | |
*/ | |
add_filter( 'dkpdf_mpdf_font_dir', function ( $font_dir ) { | |
// path to wp-content directory | |
$wp_content_dir = trailingslashit( WP_CONTENT_DIR ); |
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 | |
/** | |
* Example for front end post edit with Caldera Forms. Use code to show a Caldera Form at the bottom of a single post if user is an Administrator for WordPress. | |
*/ | |
add_filter( 'the_content', 'show_cf_form_for_admins' ); | |
function show_cf_form_for_admins( $content ) { | |
if( is_single() && current_user_can( 'edit_posts' ) ){ | |
//change to your form ID you would like to display. | |
$content .= Caldera_Forms::render_form( 'CF58e4c8ae55fa2' ); |
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 | |
/** | |
* UI for Example Caldera Forms Processor | |
* | |
* Using the UI generator is way simpler than reverse engineering UI markup and provides for better forward-compatibility | |
*/ | |
echo Caldera_Forms_Processor_UI::config_fields( my_processor_extra_meta_processor_fields() ); |
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 adbc () { | |
IP=`adb shell ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'` | |
adb tcpip 5555 | |
adb connect $IP | |
adb devices | |
} | |
function adbscr () { | |
echo "Shoot" | |
adb shell screencap -p /sdcard/screen.png |
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 | |
/** | |
* Change the default for a dropdown to "red" if a specific user meta key is set for current user | |
*/ | |
add_filter( 'caldera_forms_render_field_structure', function( $field_structure, $form ){ | |
//make sure to change field ID to your field's ID here! | |
//not that $field_structure is not the same as field config, but that is stored in $field_structure[ 'field' ] | |
if( 0 != get_current_user_id() && 'fld_1234' == $field_structure[ 'field' ][ 'ID' ] ) { | |
if( 'red' == get_user_meta( get_current_user_id(), 'color', true ) ){ | |
$field_structure[ 'default' ] = 'red'; |
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_render_get_field', function( $field ) { | |
if( 'fld123456' == $field[ 'ID' ] ){ | |
$field[ 'config' ][ 'default' ] = esc_url_raw( caldera_forms_get_current_url() ); | |
} | |
return $field; | |
}); |
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( 'the_content', function( $content ){ | |
$post = get_post(); | |
if( 42 ===$post->ID ){ | |
$form = 'cf1234567'; | |
$content .= Caldera_Forms::render_form( $form ); | |
$content .= Caldera_Forms_Entry_Viewer::form_entry_viewer_2( $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 | |
namespace App; | |
class WpApi { | |
protected static $url = 'https://calderaforms.com/wp-json/wp/v2/'; | |
public static function getPost(int $id ) |
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
add_action( 'init', function(){ | |
if ( ! is_admin()) { | |
if( is_ssl() ){ | |
$protocol = 'https'; | |
}else { | |
$protocol = 'http'; | |
} | |
/** @var WP_Scripts $wp_scripts */ | |
global $wp_scripts; |
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
add_filter( 'caldera_forms_autopopulate_options_post_value_field', 'givewp_customer_addon_purchases', 24, 2 ); | |
function givewp_customer_addon_purchases() | |
{ | |
$current_user = wp_get_current_user(); | |
$purchases = edd_get_users_purchases($current_user->user_email, 100, false, 'any'); | |
if ( $purchases ) { | |
foreach ($purchases as $purchase) { | |
$licenses = edd_software_licensing()->get_licenses_of_purchase( $purchase->ID ); |
NewerOlder