Skip to content

Instantly share code, notes, and snippets.

View warnakey's full-sized avatar

warnakey

View GitHub Profile
@warnakey
warnakey / NewsArticle-Schema.html
Created April 17, 2023 15:15
NewsArticle Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"url": "http://www.bbc.com/news/world-us-canada-39324587",
"publisher":{
"@type":"Organization",
"name":"BBC News",
"logo":"http://www.bbc.co.uk/news/special/2015/newsspec_10857/bbc_news_logo.png?cb=1"
},
@warnakey
warnakey / faqpage-schema-example.html
Last active February 1, 2023 21:05
FAQpage Schema Example
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "FAQPage",
"mainEntity": [
{ // start question
"@type": "Question",
"name": "Are employers required to pay severance in New Jersey? ",
"text": "Are employers required to pay severance in New Jersey? ",
"author": {
@warnakey
warnakey / legalservice-example.html
Created December 1, 2022 19:31
Legal Service schema example for lawyer website
<script type="application/ld+json">
{
"@context": "http://www.schema.org",
"@type": "LegalService",
"name": "The Dominguez Firm",
"telephone": "(800) 818-1818",
"priceRange": "$$$",
"url": "https://dominguezfirm.com",
"sameAs": [
"https://twitter.com/DominguezFirm",
@warnakey
warnakey / attorney-schema-example.html
Created December 1, 2022 19:30
Attorney schema for legal website
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Attorney",
"name": "Rose, Klein & Marias LLP",
"alternateName": " Rose, Klein & Marias",
"description": "Los Angeles personal injury attorneys",
"url" : "https://www.rkmlaw.com",
"logo" : "https://www.rkmlaw.com/wp-content/uploads/2019/11/RKMlogo.jpg",
"image" : "https://www.rkmlaw.com/wp-content/uploads/2019/11/att-riffel.jpg",
@warnakey
warnakey / review-schema-example.html
Created December 1, 2022 19:28
Review schema for legal website
<script type="application/ld+json">{
"@context": "http://schema.org/",
"@type": "Review",
"reviewBody": "They make you feel safe and taken care of. They take care of so much, they really reduce the anxiety.",
"itemReviewed": {
"@type": "LegalService",
"name": "Rose, Klein & Marias LLP",
"telephone": "(800) 362-7427",
"address": {
"@type": "PostalAddress",
@warnakey
warnakey / clear-woocommerce-cart-on-a-specific-page-first-time-you-visit.php
Last active September 5, 2021 00:23
Clear things from the WooCommerce cart the first time you visit a page
// This would go in your functions.php file
// Clear things out of the cart the first time you visit a specific page (only run this script once)
add_action( 'template_redirect', 'clear_cart_items_custom_checkout' );
function clear_cart_items_custom_page() {
global $post;
$slug = $post->post_name;
if($slug == 'exclusive-invitation') { // Replace this with the Slug of the page you want to clear the cart on
global $woocommerce;
$woocommerce->cart->empty_cart();
@warnakey
warnakey / woocommerce-specific-page-function.php
Created September 4, 2021 22:54
WooCommerce Function Only Applied To A Specific Page
/* This goes in your functions.php file */
/* When the woocommerce cart is updated on the page with ID 353034, print "test" at the top of the page */
/* This is an example of using 2 functions together with an action hook */
function action_woocommerce_cart_updated() {
add_action('get_header', function() {
if (is_page('353034')) {
echo 'test';
@warnakey
warnakey / change-woocommerce-notices.php
Created September 4, 2021 21:08
If you want to change the text of WooCommerce notices
<!-- You can add this near the bottom of your footer.php -->
<!-- As an example, assume your checkout page had these 2 notifications by default -->
<!-- and you wanted to replace both of them: https://i.snipboard.io/MvmKWL.jpg -->
<?php if($post->ID == 353034) } /* Change this ID to match the ID of your checkout page */ ?>
<script>
var getAllWooMessages = document.getElementsByClassName("woocommerce-info");
for (var i = 0; i < getAllWooMessages.length; i++) {
(function(x) {
@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 / 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