Skip to content

Instantly share code, notes, and snippets.

@jmcausing
jmcausing / theme.json
Last active July 22, 2024 07:28
Shoptimizer font workaround
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"appearanceTools": true,
"custom": {
"lineHeight": {
"none": 1,
"tight": 1.1,
"snug": 1.2,
@jmcausing
jmcausing / gist:b6819983adf39cf53004f7033333fb54
Created May 2, 2024 09:46
WPML + CommerceKit Ajax search fix - class-commercekit-ajs-index.php
<?php
/**
*
* Admin Ajax Search Index
*
* @package CommerceKit
*/
/**
* CommerceKit_AJS_Index class.
@jmcausing
jmcausing / gist:5cd4122d3f24e9543d80556f8e476fe8
Created November 8, 2023 23:09
WP recommended resources, forums, or websites for further reading and continued learning.
Documentation/Resources:
- WordPress Codex: Official WordPress documentation providing extensive information and troubleshooting guides.
Link: https://codex.wordpress.org/
- WordPress Support Forums: Community-driven forums where users can ask questions and find solutions to various WordPress issues.
Link: https://wordpress.org/support/
- WPBeginner: Offers tutorials, tips, and resources for WordPress beginners and advanced users.
Link: https://www.wpbeginner.com/
@jmcausing
jmcausing / gist:a04a03b8ba451aacf4569beb4b7addc5
Created November 8, 2023 23:05
WordPress 500 Simulation
Creating plugins intentionally causing a 500 Internal Server Error is not a common practice due to the potential risks and impact on a live website. However, for educational purposes or testing on a local or staging site, you might create custom plugins that result in an error, simulating a 500 Internal Server Error.
Here are three basic examples of custom plugins that could potentially cause a 500 Internal Server Error:
### Plugin 1: PHP Fatal Error
Create a custom plugin with PHP code that causes a fatal error.
```php
<?php
/*
@jmcausing
jmcausing / gist:5860ecbbd5c885df414e0c8ee1559717
Created June 2, 2023 07:41
Shoptimizer - Add product to cart but disable the add-to-cart ajax (opens the cart side bar)
add_action( 'after_setup_theme', 'cg_remove_default_cart_drawer', 99 );
function cg_remove_default_cart_drawer() {
remove_action( 'shoptimizer_before_site', 'shoptimizer_header_cart_drawer', 5 );
add_action( 'shoptimizer_before_site', 'shoptimizer_header_cart_drawer_updated', 5 );
}
if ( ! function_exists( 'shoptimizer_header_cart_drawer_updated' ) ) {
/**
* Display Header Cart Drawer
*
@jmcausing
jmcausing / gist:3172104e28cca6fd5329d6f6c73a4663
Created May 31, 2023 08:47
WooCommerce - Add additional sorting by sales (ASC) - exclude out of stock
// Add sorting option to sort products by sales (ASC) on the shop page
function add_custom_product_sorting_option( $options ) {
$options['sales_asc'] = __( 'Sort by Sales (ASC)', 'text-domain' );
return $options;
}
add_filter( 'woocommerce_get_catalog_ordering_args', 'add_custom_product_sorting_option' );
// Define sorting option arguments for sorting by sales (ASC) and excluding out-of-stock products
function set_custom_product_sorting_option( $sort_args ) {
if ( isset( $_GET['orderby'] ) && 'sales_asc' === $_GET['orderby'] ) {
@jmcausing
jmcausing / gist:377321eb2760eb350b573ea011a8dcd2
Created May 31, 2023 08:46
WooCommerce - Add additional sorting by sales (ASC)
// Add sorting option to sort products by sales (ASC) on the shop page
function add_custom_product_sorting_option( $options ) {
$options['sales_asc'] = __( 'Sort by Sales (ASC)', 'text-domain' );
return $options;
}
add_filter( 'woocommerce_get_catalog_ordering_args', 'add_custom_product_sorting_option' );
// Define sorting option arguments for sorting by sales (ASC)
function set_custom_product_sorting_option( $sort_args ) {
if ( isset( $_GET['orderby'] ) && 'sales_asc' === $_GET['orderby'] ) {
@jmcausing
jmcausing / gist:af1be9cbfd25ddbca9f51107382890d3
Created May 29, 2023 10:23
CommerceKit - add to cart without opening the sidebar cart automatically.
add_action( 'after_setup_theme', 'cg_remove_default_cart_drawer', 99 );
function cg_remove_default_cart_drawer() {
remove_action( 'shoptimizer_before_site', 'shoptimizer_header_cart_drawer', 5 );
add_action( 'shoptimizer_before_site', 'shoptimizer_header_cart_drawer_updated', 5 );
}
if ( ! function_exists( 'shoptimizer_header_cart_drawer_updated' ) ) {
/**
* Display Header Cart Drawer
*
@jmcausing
jmcausing / gist:b0f9d5132e5b35bcae7266367eaae969
Created December 25, 2022 01:07
Serial port 1 (console)
Serial port 1 (console) output for instance-1-eng-2819
[=3h[=3hCSM BBS Table full.
BdsDxe: loading Boot0003 "ubuntu" from HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
BdsDxe: starting Boot0003 "ubuntu" from HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
UEFI: Attempting to start image.
Description: ubuntu
FilePath: HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
OptionNumber: 3.
vagrant@causingdesigns:~/trellis$ ansible-playbook deploy.yml -e env=staging -e site=staging-rosellejoycausing.kinsta.cloud --limit=kinsta_staging
/usr/local/lib/python2.7/dist-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning,
PLAY [Ensure necessary variables are defined] *******************************************************************************************************************************
[WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin
(<ansible.plugins.callback./home/vagrant/trellis/lib/trellis/plugins/callback/vars.CallbackModule object at 0x7f891b69c990>): 'AnsibleUnicode' object has no attribute
'get_groups'
skipping: no hosts matched