Skip to content

Instantly share code, notes, and snippets.

View joshuadavidnelson's full-sized avatar

Joshua Nelson joshuadavidnelson

View GitHub Profile
@sethryder
sethryder / yoast_redirect_fixer.php
Last active April 29, 2022 18:16
update redirects in yoast when changing from date based permalinks to just post name
<?php
$option_value_export_plain = file_get_contents('export_plain.txt');
$option_value_base = file_get_contents('base.txt');
$export_plain = unserialize($option_value_export_plain);
$base = unserialize($option_value_base);
$new_export_plain = [];
@dartiss
dartiss / functions.php
Created November 15, 2017 18:27
WordPress Plugin to Suppress Skimlinks Output
<?php
function skim_suppress( $paras = '', $content = '' ) {
return '<div class="noskim">'. do_shortcode( $content ) . '</div>';
}
add_shortcode( 'noskim', 'skim_suppress' );
?>
@benjamincharity
benjamincharity / autonomous.txt
Last active April 12, 2024 22:20
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@joshuadavidnelson
joshuadavidnelson / basic-wp-query.php
Last active August 11, 2019 06:27
Basic WP Query
<?php
$args = array(
'post_type' => array( 'post' ),
'post_status' => array( 'publish' ),
'posts_per_page' => 100, // don't use -1, pick something reasonable
'no_found_rows' => true, // useful when pagination is not needed.
'update_post_meta_cache' => false, // useful when post meta will not be utilized.
'update_post_term_cache' => false, // useful when taxonomy terms will not be utilized.
// 'ignore_sticky_posts' => true, // ignore sticky posts
@paulirish
paulirish / bling.js
Last active April 20, 2024 17:39
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@adamplabarge
adamplabarge / gf-acf-image-attachment-maker.php
Last active October 27, 2016 20:41
GF-ACF image attachment maker
<?php
//* the the default upload path to work in normal WP structure
add_filter("gform_upload_path", "change_upload_path", 20, 2);
function change_upload_path($path_info, $form_id){
$wp_upload_path = wp_upload_dir();
$path_info["path"] = $wp_upload_path['path'] . '/';
$path_info["url"] = $wp_upload_path['url'] . '/';
return $path_info;
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@amdrew
amdrew / gist:07cec5563ab95720dca5
Created December 18, 2014 04:43
Easy Digital Downloads - Add specific download to cart if it doesn't already exist
<?php
/**
* Add a specific download to the cart if not already there
*/
function sumobi_edd_add_download_to_cart_if_empty() {
$download_id = 123;
$cart = function_exists( 'edd_get_cart_contents' ) ? edd_get_cart_contents() : false;
@jaydansand
jaydansand / wp_allow_update_notifications.php
Last active January 3, 2022 17:45
WordPress plugin to allow module/theme/core update notifications even when DISALLOW_FILE_MODS is TRUE.
<?php
/*
Plugin Name: Allow Update Notifications
Plugin URI: https://gist.github.com/jaydansand/2e41490a8b040a199db4
Description: WordPress plugin to allow module/theme/core update notifications even when DISALLOW_FILE_MODS is TRUE.
Version: 1.0
Author: Jay Dansand, Technology Services, Lawrence University
Author URI: https://gist.github.com/jaydansand
*/
/* Copyright 2014 Lawrence University