Skip to content

Instantly share code, notes, and snippets.

View warnakey's full-sized avatar

warnakey

View GitHub Profile
@warnakey
warnakey / force-wistia-embed-to-show-custom-poster.html
Last active September 4, 2021 18:37
Force Wistia Video Embeds to show a custom poster image, like a GIF
<div class="video" id="customvideo">
<script src="https://fast.wistia.com/embed/medias/ugydl9lr6t.jsonp" async></script><script src="https://fast.wistia.com/assets/external/E-v1.js" async></script><div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;"><div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;"><div class="wistia_embed wistia_async_ugydl9lr6t videoFoam=true" style="height:100%;position:relative;width:100%"><div class="wistia_swatch" style="height:100%;left:0;opacity:0;overflow:hidden;position:absolute;top:0;transition:opacity 200ms;width:100%;"><img src="https://fast.wistia.com/embed/medias/ugydl9lr6t/swatch" style="filter:blur(5px);height:100%;object-fit:contain;width:100%;" alt="" aria-hidden="true" onload="this.parentNode.style.opacity=1;" /></div></div></div></div>
</div>
<script>
jQuery(window).bind("load", function () {
var customvideothumbnail = document.querySelector('#customvideo div.w-css-reset:nth-of-type
@warnakey
warnakey / remove-gifs.js
Created September 3, 2021 01:17
Remove GIFs from a collection of images
/*
Let's say you have a series of images, and some are JPGs or PNGs, but some are GIFs too. If you want to remove the GIFs, you can do this.
Let's assume your HTML looked like this:
<div>
<img src="https://sqairz.com/wp-content/uploads/2021/04/freedom-white-silver-gif-600x394.gif">
<img src="https://sqairz.com/wp-content/uploads/2021/04/Sqairz-Shoes_071-600x600.jpg">
<img src="https://sqairz.com/wp-content/uploads/2021/04/freedom-white-silver-gif-600x394.gif">
</div>
*/
@warnakey
warnakey / WooCommerce-disable-UPS-shipping-options-if-shipping-to-a-PO-Box.php
Created August 20, 2021 06:16
Code for WooCommerce site to disable UPS shipping options if shipping to a PO Box (because UPS doesn't ship to PO Boxes)
<!-- You can add this to your footer.php file -->
<!-- UPS does'nt ship to PO Boxes, so if your site has multiple carriers (ex. USPS, FedEx & UPS) you would disable UPS for PO boxes -->
<!-- ** REPLACE ** the ID below to be the one for your WooCommerce checkout page !!!!!! -->
<?php if($post->ID == 2309) { // only works on checkout page ?>
<script>
// find the billing and shipping email fields to use for event listeners
// This code will fire when the customer clicks off of either email field
<!-- You could put this in your footer.php file near the bottom -->
<!--Function to find out what time it is, so we can disable some shipping options from Friday 2pm EST through Monday at midnight EST.-->
<?php if( $post->ID == 2305 || $post->ID == 2309) { // **REPLACE** these IDs with your CART and CHECKOUT pages! *important*
// Function to get the day of the week. Returns 0 through 6. Sunday = 0, Saturday = 6.
function getWeekday($date) {
return date('w', strtotime($date));
}
// You can find out what day of the week any date is like this
// echo "The day of the week is: ";
@warnakey
warnakey / Prevent-Spam-Robot-From-Completing-WooCommerce-Orders-Based-On-City.php
Last active August 18, 2021 22:57
This code prevents Spam robots from completing orders on WooCommerce if they type the city field as 'dsfsdf' then kicks them off the website
/* You can put this in your footer.php file */
/* This code checks if Spam robots type the City field in the WooCommerce checkout page as 'dsfsdf' and kicks them out */
/* This can be modified to any condition you like by changing the if statements and event listeners around */
<?php if( $post->ID == 2309 ) { ?> // change this to your Checkout page's ID
<script>
// get variables for the different fields in the woocommerce checkout form (note 'billing' vs 'shipping' side)
var cityfield = document.getElementById('billing_city');
var postfield = document.getElementById('billing_postcode');
@warnakey
warnakey / custom-klaviyo-form.html
Created August 17, 2021 00:20
Custom Klaviyo Form With Radio Buttons
<!-- REPLACE ALL INSTANCES OF "LIST_ID" WITH YOUR KLAVIYO LIST ID! THIS IS VITALLY IMPORTANT -->
<form id="contest_week_one" class="klaviyo_styling klaviyo_gdpr_embed_LIST_ID" action="//manage.kmail-lists.com/subscriptions/subscribe" data-ajax-submit="//manage.kmail-lists.com/ajax/subscriptions/subscribe" method="GET" target="_blank" novalidate="novalidate">
<input type="hidden" name="g" value="LIST_ID">
<input type="hidden" name="$fields" value="$consent">
<input type="hidden" name="$list_fields" value="$consent">
<div class="klaviyo_field_group">
<!--<label for="k_id_first_name">First Name</label>-->
<input class="" type="text" value="" name="first_name" id="k_id_first_name" placeholder="First Name" />
<!--<label for="k_id_last_name">Last Name</label>-->
<input class="" type="text" value="" name="last_name" id="k_id_last_name" placeholder="Last Name" />
@warnakey
warnakey / functions.php
Created August 7, 2021 07:38
WooCommerce - Place Orders On Hold if billing and shipping information are different
<?php
/* PLACE ORDERS ON HOLD WHEN BILLING & SHIPPING INFO DO NOT MATCH */
add_action( 'woocommerce_thankyou', 'woocommerce_billing_shipping_address_match', 10, 1);
function woocommerce_billing_shipping_address_match( $order_id ) {
if ( ! $order_id ) {
return;
}
// Get the order id
$order = wc_get_order( $order_id );
@warnakey
warnakey / Dentist with Multiple Locations Schema Example
Last active April 22, 2021 18:59
Dentist Schema with Multiple Locations
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Dentist",
"url": "https://www.example.com/",
"priceRange": "$",
"brand": {
"name": "Example Dentist"
},
"name": "Example Dentist",
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "VideoObject",
"name": "Child Custody",
"description": "One of the most litigated issues that can arise during a divorce is child custody and visitation. North Carolina law provides that custody determinations are to be made in the best interests of the child.",
"thumbnailUrl": "https://www.divorceistough.com/wp-content/uploads/2019/03/child-custody-video-thumbnail.jpg",
"uploadDate": "2017-08-08T09:48:00-05:00",
"duration": "PT3M31S",
"contentUrl": "https://vimeo.com/228817202",
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "JobPosting",
"datePosted": "2019-09-09T10:25:00-05:00",
"validThrough": "2050-09-21T09:48:00-05:00",
"title": "Crew Member",
"description": "Crew member positions include: cashiers, cooks, grill, dining room attendants, biscuit makers and drive-thru. Must be at least 16 years old. Successful candidates are passionate about customer service and serving high quality food with a smile. Candidates must be able to manage many time-sensitive tasks simultaneously, are extremely organized, have high standards of professionalism, have a positive attitude and are team players.",
"skills": "Passionate about customer service and serving high quality food with a smile. Candidates must be able to manage many time-sensitive tasks simultaneously, be extremely organized, have high standards of professionalism, have a positive attitude and are team players.",
"employmentType": "Fu