This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleHeaderLogic = (() => { | |
const header = document.querySelector('header'); | |
const sections = document.querySelectorAll('.section'); | |
const whereSectionsStartAndEnd = {} | |
const headerHeight = 132; | |
let lastPosition = Math.ceil(window.scrollY); | |
let ticking = false; | |
// scrolls to section when menu item is clicked | |
const handleClickOnMenuItems = (() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for FILE in *; do squoosh-cli --mozjpeg 50 --resize '{width: 1000, height: 1000}' "$FILE"; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getYoutubeVideoStatus( $video_id ){ | |
/** | |
* Get the status of a youtube video | |
* @param string $video_id | |
* @return string | false | |
*/ | |
$url = "https://www.googleapis.com/youtube/v3/videos?part=status&id=$video_id&key=YOUR_API_KEY_HERE"; | |
$results = json_decode(file_get_contents($url)); | |
return( isset( $results->items[0]->status->privacyStatus ) ) ? $results->items[0]->status->privacyStatus : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_setenvif.c> | |
# Vary: Accept for all the requests to jpeg and png | |
SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Check if browser supports WebP images | |
RewriteCond %{HTTP_ACCEPT} image/webp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcfbt_get_variation_dropdown( $product_id ){ | |
/** | |
* Create a inline dropdown for selecting available product variations | |
*/ | |
$product = wc_get_product( $product_id ); | |
// if product exists and has available variations to list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// use woocommerce select2 | |
wp_enqueue_style('select2', WC()->plugin_url() . '/assets/css/select2.css' ); | |
wp_enqueue_script('select2', WC()->plugin_url() . '/assets/js/select2/select2.min.js', array('jquery') ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Put the product's brand and link to archive above product title on single_product page. | |
add_action( 'woocommerce_single_product_summary', 'msp_brand_name', 1 ); | |
// Put same link on shop page | |
add_action( 'woocommerce_before_shop_loop_item_title', 'msp_brand_name', 15 ); | |
function msp_brand_name(){ | |
/** | |
* Get the product's brand name and link to brand archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rsync -v -a -e 'ssh -p 2200' [email protected]:home/wp-content/uploads/ uploads/ | |
// Keep in mind that rsync works left to right (from => target). | |
// -v verbose lets you know things are happening | |
// -a archive maintains preserves directory structure | |
// -e executes a piece of code ( I use it to target a specific port for ssh ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function msp_maybe_category_description( $content ){ | |
/** | |
* Gets current product category, sorts terms in hierarchy order | |
* | |
* @param string $content | |
* @return string $content | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hooks into invoice.php | |
add_action( 'wpo_wcpdf_after_order_data', 'msp_add_meta_data_to_wpo_invoice', 100, 2 ); | |
function msp_add_meta_data_to_wpo_invoice( $type, $order ){ | |
/** | |
* Adds custom meta data to WPO generated invoice plugin | |
* DOC: https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/pdf-template-action-hooks/ | |
* @param string $template_type |
NewerOlder