Skip to content

Instantly share code, notes, and snippets.

View stephenfeather's full-sized avatar

Stephen Feather stephenfeather

View GitHub Profile
@mehrshaddarzi
mehrshaddarzi / wordpress_image.php
Last active July 13, 2025 23:27
wordpress image thumbnail list Hook
<?php
// Upload to Custom folder in media_handle_upload
https://wordpress.stackexchange.com/questions/290257/media-handle-upload-with-custom-upload-folder
//Download image and to attachment
https://codex.wordpress.org/Function_Reference/media_handle_sideload
//change SrcSet
https://gschoppe.com/wordpress/fix-broken-images-after-wordpress-4-4-update/
@thangman22
thangman22 / register.js
Created April 1, 2018 07:21
Workbox for Wordpress
async function addToCache(urls) {
const pageCache = await window.caches.open('page-cache');
await pageCache.addAll(urls);
}
// Check that service workers are registered
if ('serviceWorker' in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener('load', () => {
addToCache(['/hello-world/', '/main-page/']);
@menushka
menushka / airdropSorter.scpt
Created December 30, 2018 22:47
A Folder Action script written in AppleScript used to separate AirDropped files into a different folder other than the default Downloads folder
property AIRDROP_FOLDER : "Path:to:AirDrop:Folder:in:Alias:format"
property QUARANTINE_KEY : "59"
property GET_QUARANTINE_COMMAND_START : "ls -l -@ '"
property GET_QUARANTINE_COMMAND_END : "' | tr '\\n' ' ' | sed 's/.*com\\.apple\\.quarantine\\s*\\(\\d*\\)/ \\1/' | awk '{$1=$1};1'"
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to length of added_items
set current_item to item i of added_items
set quarantine_type to getQuarantineType(POSIX path of current_item)
@imanispatel
imanispatel / functions.php
Last active March 17, 2023 02:56
Replace display name with first name & last name in name value
<?php
/**
* Set custom user variable for WooCommerce Wave Connector
* Replace display name with first name & last name in name value
*
* @param array $variables get variables.
* @param array $user_ids get user's id.
* @return array
*/
function custom_customer_variable( $variables, $user_ids ) {
@RadGH
RadGH / wp-optimized-taxonomy-mysql.php
Last active May 21, 2023 21:35
Optimize wordpress WP_Term_Query mysql request
<?php
// Example long query (2.557 seconds):
// @see https://radleysustaire.com/s3/1c66a3/
// Example optimized query (0.316 seconds):
// @see https://radleysustaire.com/s3/fb794e/
// Example of what your code would look like:
$args = array(
'taxonomy' => array( 'account-menu' ),
@lukecav
lukecav / Links
Created September 23, 2022 20:59
WP Activity Log plugin information
@lukecav
lukecav / Links
Created December 8, 2022 19:17
CodeWP AI code generation
@lukecav
lukecav / Commands
Created June 27, 2023 19:27
WPVulnerability WP-CLI support
wp wpvulnerability core
wp wpvulnerability plugins
wp wpvulnerability themes