Skip to content

Instantly share code, notes, and snippets.

View bstonedev's full-sized avatar

Brett Stone bstonedev

View GitHub Profile
@bstonedev
bstonedev / moi-product-content.liquid
Created August 14, 2023 05:58
Product Page code - The Best of MOI
<div class="single-product-banner__content">
<div class="sigle-product__review">
<div class="yotpo bottomLine"
data-product-id="{{ product.id }}">
</div>
<a class="reviews-wrap__link" href="#single-product__reviews-wrap"></a>
{% comment %}
@bstonedev
bstonedev / advanced-wc-order-debug.php
Created May 31, 2023 22:15
advanced-wc-order-debug.php
<?php
add_action('updated_post_meta','shop_order_meta_updated', 10, 4);
function shop_order_meta_updated($meta_id, $post_id, $meta_key, $meta_value) {
$type = get_post_type( $post_id );
if ($type == 'shop_order') {
error_log("shop_order_meta_updated");
error_log("shop_order ID:" . $post_id);
error_log("meta_key:" . print_r($meta_key, true) );
error_log("meta_value:" . print_r($meta_value, true) );
error_log(wp_debug_backtrace_summary());
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
alias wp="php wp-cli.phar"
@bstonedev
bstonedev / mac-os-dns-commands.txt
Created February 12, 2023 23:12
Mac OS - Terminal Commands to Edit Etc/Hosts File and Flush DNS Cache
sudo nano /etc/hosts
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@bstonedev
bstonedev / display-all-image-sizes.php
Created January 27, 2023 00:55
Display All Available Media Image Sizes
<?php
function add_custom_image_sizes() {
global $_wp_additional_image_sizes;
print '<pre>';
print_r( $_wp_additional_image_sizes );
print '</pre>';
}
add_action( 'after_setup_theme', 'add_custom_image_sizes' );
@bstonedev
bstonedev / examples-bad-variables.js
Last active January 23, 2023 23:15
Examples of Bad Javascript Variable Names
// Bad
var sync1 = jQuery("#sync1");
sync1.owlCarousel({
items: 1,
slideSpeed: 2000
});
// Good
let productPageMainSlider = jQuery(".product-page__main-slider");
productPageMainSlider.owlCarousel({
@bstonedev
bstonedev / examples.php
Created January 23, 2023 19:59
PHP Fromatting examples
<!-- Bad -->
<div class="layout-col-4">
<?php
if ( is_active_sidebar( 'footer_sidebar_one' ) ) {
?>
<div id="footer-sidebar-one" class="footer-sidebar widget-area" role="complementary">
<?php
dynamic_sidebar( 'footer_sidebar_one' );
?>
</div><!-- #footer_sidebar -->
@bstonedev
bstonedev / disable-comments.php
Created January 10, 2023 22:25
Disable Comments in WordPress - Code Snippet
<?php
// Place in functions.php
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
add_filter('comments_array', '__return_empty_array', 10, 2);
add_action('admin_init', array($this, 'remove_comments_links_from_dashboard'));
add_action('admin_menu', array($this, 'remove_comments_page_in_menu'));
function remove_comments_page_in_menu() {
remove_menu_page('edit-comments.php');
@bstonedev
bstonedev / line-clamp.css
Created November 15, 2022 03:00
line-clamp.css
.line-clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
@bstonedev
bstonedev / .gitignore-for-shopify-themes
Created November 6, 2022 21:20
.gitignore for Shopify Themes
# Shopify #
###################
config.yml
config/settings_data.json
# OS generated files #
######################
.DS_Store
.DS_Store?
._*