Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
🙏
If we're kind and polite, the world will be right.

Luke Cavanagh lukecav

🙏
If we're kind and polite, the world will be right.
View GitHub Profile
@lukecav
lukecav / Command
Created January 9, 2025 18:28
Update the logs retention period in WooCommerce to be 15 days from 30 days
wp option update woocommerce_logs_retention_period_days 15
@lukecav
lukecav / functions.php
Created August 14, 2018 13:50
Enable revisions on products in WooCommerce
add_filter( 'woocommerce_register_post_type_product', 'wc_modify_product_post_type' );
function wc_modify_product_post_type( $args ) {
$args['supports'][] = 'revisions';
return $args;
}
@lukecav
lukecav / Prompt examples
Last active December 4, 2024 20:36
Stable Diffusion XL Prompt examples
Cinematic images
detailed textures, sharp focus, ultra-high pixel detail, intricate, realistic, movie scene, cinematic, high-quality, full colors, incredibly detailed, 4k, 8k, 16k, hyper-realistic, RAW photo, masterpiece, ultra-detailed, professionally color graded, professional photography
cinematic, cinematic lighting, 8K raw photo, best quality, masterpiece, ultra high res, realistic, photography, digital painting, vibrant, intricate details, high-definition, detailed, sharp focus, 8k uhd
Lens Types
Wide-angle lens
Telephoto lens
@lukecav
lukecav / Commands
Created October 29, 2024 18:19
How to temporarily stop and start the Imunify360 service
systemctl stop imunify360
systemctl start imunify360
@lukecav
lukecav / Command
Last active October 16, 2024 16:03
Update Advanced Custom Field plugin using WP-CLI
wp plugin install --force https://www.advancedcustomfields.com/latest/
@lukecav
lukecav / Commands
Last active October 11, 2024 03:13
Speed up wp db export using WP-CLI
# Export site database using wp db export
wp db export /wp-content/wordpress-dump.sql --all-tablespaces --single-transaction --quick --lock-tables=false
# Gzip compress the recent database export
gzip wordpress-dump.sql
# Export sites database using wp db export and gzip compress
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz
@lukecav
lukecav / functions.php
Last active October 9, 2024 00:34
Remove WooCommerce PayPal Powered by Braintree Payment Gateway PayPal button from the checkout and cart
// Remove PayPal button from checkout
add_filter( 'woocommerce_available_payment_gateways', '_wc_remove_braintree_pay_with_paypal' );
function _wc_remove_braintree_pay_with_paypal( $gateways ) {
unset( $gateways['paypalbraintree_paypal'] );
return $gateways;
}
// Remove PayPal button from cart
add_filter( 'wc_gateway_paypal_braintree_data', '_wc_remove_braintree_checkout_with_paypal' );
function _wc_remove_braintree_checkout_with_paypal( $data ) {
@lukecav
lukecav / custom-register-fields.php
Last active October 9, 2024 00:34
Custom Registered FIelds Plugin
<?php
/*
Plugin Name: Custom Register Fields
Plugin URI: http://www.lcavanagh.bluehoststaff.com/
Description: Add first name, last name and job title.
Author: Luke Cavanagh
Version: 1.0
Author URI: http://www.lcavanagh.bluehoststaff.com/
GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
*/
@lukecav
lukecav / gist:6568c381e120899d46c1d504979ca6d1
Last active October 9, 2024 00:34
Gravity Forms Input Focus on Page Load by Form ID and Field ID
<script type="text/javascript">// <![CDATA[
jQuery(document).bind('gform_page_loaded', function(event, form_id, current_page){
$(document).ready(function(){
$("#gf_field_id").focus();
});
// ]]></script>
@lukecav
lukecav / DNS Prefetch domains
Last active October 9, 2024 00:30
WP Rocket - Advanced Options Prefetch DNS requests examples
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com