Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle B. Johnson kjohnson

View GitHub Profile
View give_fields_hooks
'give_fields_before_donation_levels',
'give_fields_after_donation_amount',
'give_fields_after_donation_levels',
'give_fields_payment_mode_top',
'give_fields_payment_mode_before_gateways',
'give_fields_payment_mode_after_gateways',
'give_fields_payment_mode_after_gateways_wrap',
'give_fields_payment_mode_bottom',
'give_fields_donation_form',
'give_fields_purchase_form_top',
@kjohnson
kjohnson / wordpress.test.conf
Created Feb 23, 2021
WordPress on Apache over HTTPS with pretty permalinks
View wordpress.test.conf
# /etc/apache2/sites-available/wordpress.test.conf
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
View .bash_aliases
function wordpress() {
cd ~/WordPress
}
function wpdebug() {
pwd=$PWD
cd ~/WordPress
wp config set WP_DEBUG $1 --raw
cd "$pwd"
}
@kjohnson
kjohnson / .bash_aliases
Last active Oct 28, 2020 — forked from joshlevinson/.bash_profile
WP CLI + Xdebug
View .bash_aliases
function wpx {
export XDEBUG_CONFIG="idekey=WPCLIDEBUG remote_connect_back=1"
wp "$@"
unset XDEBUG_CONFIG
};
View gist:ddd59433f2bdaa8be62e9a9c77f2cccd
<?php
// Formatted string.
echo sprintf( 'This is a known %s being translated.', __( 'Translated String' ) );
// Interpolation
extract([
'string' => __( 'Translated String' )
]);
echo "This is a user provided ${string}";
@kjohnson
kjohnson / callback.js
Last active Jan 15, 2020
Caldera Forms Dynamic Processor Setting Example Use
View callback.js
console.log('loaded');
function myDynamicOptionsCallback(resolve, reject){
// alert('Fetching select options');
console.log('Callback start');
setTimeout(function(){
console.log('Resolving');
resolve([
{
value: 'aye',
@kjohnson
kjohnson / plugin.php
Created Oct 11, 2019
Ninja Forms submit:response
View plugin.php
<?php
/**
* Plugin Name: Ninja Forms Sandbox
*/
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_script('ninja_forms_display_sandbox', plugin_dir_url(__FILE__) . 'script.js', ['nf-front-end'], time() );
});
View functions.php
<?php
add_filter( 'ninja_shop_possible_template_paths', function( $paths ) {
$paths[] = dirname( __FILE__ ) . '/templates/';
return $paths;
} );
View ninja-forms-email-attachments.php
<?php
add_filter( 'ninja_forms_action_email_attachments', function( $attachments, $data, $settings ) {
// Append file path.
$attachments[] = $path_to_file;
return $attachments;
}, 10, 3 );
View dynamic-list-options-add.php
<?php
/**
* Update list options during form render.
*
* @param array $options [ [ label, value, calc, (bool) selected, etc ], ... ]
* @param array $settings
*/
add_filter( 'ninja_forms_render_options', function( $options, $settings ) {
$options[] = [