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 | |
defined( 'ABSPATH' ) OR exit; | |
/** | |
* Plugin Name: Make Licenses Available for Updates on Multisite | |
* Plugin URI: https://gist.github.com/csalzano/621deacc33f2482da205f294b445485a | |
* Description: A plugin that provides license keys to the EDD SL Updates on Multisite plugin for Inventory Presser add-ons | |
* Version: 1.0.0 | |
* Author: Corey Salzano | |
* Author URI: https://coreysalzano.com/ | |
* Text Domain: invp-make-licenses-available |
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
<div class="widget"> | |
<div class="widget-content"> | |
<h2 class="widget-title">At a Glance</h2> | |
<ul class="at-a-glance"> | |
<li>Founded <b>1729</b></li> | |
<li>Size <b>23 square miles</b></li> | |
<li>Population <b><5,000</b></li> | |
<li><b>7</b> properties in the National Register of Historic Places</li> | |
</ul> | |
</div> |
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
//edit a term meta value in our Transmission custom taxonomy | |
let terms = new wp.api.collections.Tranmission(); | |
terms.fetch().done( function( t ){ | |
let target = t.find( x => 'automatic' === x.slug ); | |
if( ! target ) { return; } | |
jQuery.ajax({ | |
method: 'POST', | |
url: myplugin.rest_base_url + 'wp/v2/transmission/' + target.id, | |
//save the number 6 in a term meta key 'speeds' | |
data: { meta: { 'speeds': 6 } }, |
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
//find & delete a term in our Transmission custom taxonomy | |
let terms = new wp.api.collections.Transmission(); | |
terms.fetch().done( function( t ){ | |
let target = t.find( x => 'automatic' === x.slug ); | |
if( ! target ) { return; } | |
jQuery.ajax({ | |
method: 'DELETE', | |
url: myplugin.rest_base_url + 'wp/v2/transmission/' + target.id + '?force=true', | |
beforeSend: function ( xhr ) { | |
xhr.setRequestHeader( 'X-WP-Nonce', myplugin.nonce ); //must be wp_create_nonce( 'wp_rest' ), see paragraph 4 https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/ |
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
//insert a term into our Transmission custom taxonomy | |
let term = new wp.api.models.Transmission( { | |
name: 'Automatic', | |
description: 'A vehicle transmission that self-shifts between gear ratios', | |
slug: 'automatic' | |
} ); | |
term.save(); |
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: Elementor Form Additional Webhook | |
* Plugin URI: https://gist.github.com/csalzano/dfd754e0fe8b6ac10731fad8f257c0bf | |
* Description: Adds a second Webhook to an Elementor form | |
* Version: 1.0.1 | |
* Author: Corey Salzano | |
* Author URI: https://breakfastco.xyz/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
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( 'delete_user', 'remove_deleted_user_from_gform_entries' ); | |
function remove_deleted_user_from_gform_entries( $user_id ) { | |
//$user_id was just deleted, remove this from any entries if stored as created_by | |
global $wpdb; | |
$wpdb->query( $wpdb->prepare( " | |
UPDATE `{$wpdb->prefix}gf_entry` | |
SET `created_by` = NULL | |
WHERE `created_by` = %d | |
", $user_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
Object.defineProperty(Number.prototype, 'percentOfViewportToPixels', { | |
enumerable: false, | |
value: function( heightOrWidth ) { | |
var viewport_size = 'height' == heightOrWidth | |
? Math.max( document.documentElement.clientHeight, window.innerHeight || 0 ) | |
: Math.max( document.documentElement.clientWidth, window.innerWidth || 0 ); | |
return Math.round( viewport_size * ( this / 100 ) ); | |
} | |
}); |
NewerOlder