Skip to content

Instantly share code, notes, and snippets.

<?php
defined( 'ABSPATH' ) or die();
// make all super admins automatically local admins of all child sites
function put_supers_as_admins() {
global $wp_roles, $user, $current_user;
$man_user_id = $current_user->ID;
$man_sites = get_sites();
@jdabs
jdabs / remove-billing.php
Last active June 21, 2017 19:49 — forked from jgalea/remove-billing.php
Remove billing details from WooCommerce checkout. Forked from: https://gist.github.com/jgalea/5884548#file-remove-billing-php
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
@jdabs
jdabs / menu-theme-fix
Created August 15, 2017 16:17
fix wp theme
// mobile menu fix
jQuery(window).load(function () {
function addDblClick() {
jQuery('#main-menu a.hasSubMenu').each(function () {
var cnt = 0;
jQuery(this).click(function () {
if (cnt >= 1) {
var link = jQuery(this).attr('href');
window.location = link;
}
@jdabs
jdabs / gist:092bd78e31b12de522f037a5b9df57c9
Created August 22, 2017 14:49 — forked from ivandoric/gist:e4e46294c4d35eac0ec8
wordpress: create custom reset password page
<?php //Add all of this tu custom page template ?>
<?php
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )
{
@jdabs
jdabs / WordPress Shortcode with ob_start()
Created September 26, 2017 14:53 — forked from azizultex/WordPress Shortcode with ob_start()
WordPress Shortcode with ob_start()
function custom_query_shortcode($atts) {
// EXAMPLE USAGE:
// [loop the_query="showposts=100&post_type=page&post_parent=453"]
// Defaults
extract(shortcode_atts(array(
"the_query" => ''
), $atts));
@jdabs
jdabs / verify-wp-core-checksums
Created September 28, 2017 14:02
verify-wp-core-checksums with file last modified date shown
<?php
/**
* Verify WP Core files md5 checksums, outside WordPress.
* Use this script to verify md5 checksums of WordPress core files.
*
* Follow me on Twitter: @HertogJanR
* Please donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=J24FGGU96YSUY
*/
/*if ( version_compare( PHP_VERSION, '5.6.29', '<' ) ) {
@jdabs
jdabs / wp_mail.md
Created October 6, 2017 18:23 — forked from johnbillion/wp_mail.md
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.

@jdabs
jdabs / vote.js
Last active March 29, 2018 21:12
pseudo javascript for utxo weighted voting
// we on the webserver here
var total = 0; // current amount of votes as a dollar figure (or coin amount?)
var spentAddresses = [];
var vote = sentvote;
var walletAddr = vote.Addr;
var voteWithWeight= walletAddr.utxo;
@jdabs
jdabs / cron.php
Last active May 6, 2018 21:30
cron job file for cleaning up camera folders
<?php
class util {
public static function deleteDir($dirPath) {
if (! is_dir($dirPath)) {
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
function price(coin) {
const info = {
request: {
}
}
}