Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar
🐳
sploosh

Joel Lisenby JoelLisenby

🐳
sploosh
View GitHub Profile
View get_wpengine_installs_status.php
<?php
// Example run:
// php -f get_wpengine_installs_status.php > installs.csv
//
// acquire your username and password from https://my.wpengine.com/profile/api_access
define('API_USERNAME','');
define('API_PASSWORD','');
$result_obj = run_query( 'https://api.wpengineapi.com/v1/installs' );
@JoelLisenby
JoelLisenby / wordpress_disable_comments_pingbacks.php
Last active May 4, 2023 16:58
Disable comments and pingbacks settings for all WordPress network sites
View wordpress_disable_comments_pingbacks.php
<?php
// Disables comments and pingbacks settings for all existing sites in a WordPress network
$sites = get_sites();
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
update_option( 'default_comment_status', 'closed' );
update_option( 'default_ping_status', 'closed' );
restore_current_blog();
}
@JoelLisenby
JoelLisenby / jbl_find_replace.php
Last active April 20, 2022 04:34
Find and Replace Title and Content for Specific Post Type in WordPress with WP_Query
View jbl_find_replace.php
<?php
/* Backup site first before using. This adds a menu to wp-admin so you can run the script.
*** Visiting this menu will automatically run the script!! ***
*/
add_menu_page(
'jbl Find Replace',
'jbl Find Replace',
'manage_options',
'jbl-find-replace',
'jbl_find_replace'
@JoelLisenby
JoelLisenby / functions.php
Last active February 19, 2022 20:36
Remove Flash of Unstyled Content in WordPress using SiteOrigin Page Builder and Mega Menu
View functions.php
<?php
function head_fouc_script() {
?>
<script>
document.body.style.setProperty("visibility", "hidden", "important");
</script>
<style>
#mega-menu-wrap-primary #mega-menu-primary { /* these IDs may differ depending on the name of your menu. */
visibility: inherit; /* mega menu sets visibility visible and shows if you don't set this */
@JoelLisenby
JoelLisenby / dyndns_linode.sh
Last active August 22, 2021 19:53
A simple Dynamic DNS script for use with crontab for Linode Domain DNS Records API using dig and linode-cli from python pip
View dyndns_linode.sh
#!/bin/bash
domainid=000000
recordid=0000000
wanip=`dig @resolver4.opendns.com myip.opendns.com +short`
oldip=`linode-cli domains records-view $domainid $recordid --text --no-header --format="target"`
if [ $oldip != $wanip ]
then
linode-cli domains records-update $domainid $recordid --target $wanip
@JoelLisenby
JoelLisenby / usps_accepted_at.php
Last active June 23, 2020 16:08
Simple PHP function to check if USPS package has been accepted / picked up using official USPS API
View usps_accepted_at.php
<?php
function usps_picked_up( $tracking_number ) {
if( empty( $tracking_number ) || !ctype_alnum( $tracking_number ) ) {
return false;
}
$user_id = "YOUR_USER_ID";
$usps_api_uri = "http://production.shippingapis.com/shippingAPI.dll";
$xml = rawurlencode("<TrackRequest USERID=\"". $user_id ."\">
@JoelLisenby
JoelLisenby / getUrlWithParams.js
Last active May 15, 2020 00:15
Add/update or Remove URL parameters from the provided URL
View getUrlWithParams.js
/* getUrlWithParams()
* Add/update or remove url parameters from the provided url.
* Example: getUrlWithParams({'tab':tab_name},['remove']);
*/
var getUrlWithParams = function(url, add_update, remove = []) {
var url = new URL(url);
var splita = url.search.substr(1).split('&');
var params = {};
var merged = {};
@JoelLisenby
JoelLisenby / WP-JSON-Parser.html
Last active February 28, 2020 21:43
WP-JSON HTML Parser
View WP-JSON-Parser.html
<!doctype html>
<html>
<head>
<script>
const req = new XMLHttpRequest();
req.addEventListener('load', function(e) {
var response = JSON.parse( e.target.response );
var page_html = response.content.rendered;
@JoelLisenby
JoelLisenby / find_invisible_horizontal_scroll_elements.js
Last active December 13, 2019 17:36
JavaScript to find hidden horizontal scroll elements. Paste into browser JS console and hit enter.
View find_invisible_horizontal_scroll_elements.js
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
@JoelLisenby
JoelLisenby / off.reg
Created June 5, 2019 00:46 — forked from CHEF-KOCH/off.reg
Windows 10 ads, turn it off!
View off.reg
Windows Registry Editor Version 5.00
; Turn off File Explorer ads
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ShowSyncProviderNotifications"=dword:00000000
; Turn off Start Menu suggestions
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager]
"SystemPaneSuggestionsEnabled"=dword:00000000