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",
<!-- This is for a single page that lists a group of products on it -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ItemList",
"url": "https://www.myexamplestore.com/products/",
"numberOfItems": "2",
"itemListElement": [
{
"@type": "ListItem",
@warnakey
warnakey / ProfilePage Schema Example
Last active October 23, 2022 17:32
ProfilePage Schema Example in JSON-LD
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "ProfilePage",
"mainEntity" : {
"@type" : "Person",
"name" : "Jane Doe",
"givenName" : "Jane",
"familyName" : "Doe",
"email" : "jdoe@examplelaw.com",
@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) {