Skip to content

Instantly share code, notes, and snippets.

@henshaw
henshaw / author.json
Last active August 28, 2023 19:04
Author structured data with URL
"author": {
"@type": "Person",
"@id":"https://www.coywolf.news/jon-henshaw#Person",
"name": "Jon Henshaw",
"url":"https://www.coywolf.news/jon-henshaw/"
}
@henshaw
henshaw / multiple-authors.json
Last active August 28, 2023 19:06
Author structured data for multiple authors for a single article using an array
"author": [
{
"@type": "Person",
"@id":"https://www.coywolf.news/jon-henshaw#Person",
"name": "Jon Henshaw",
"url":"https://www.coywolf.news/jon-henshaw/"
},
{
"@type": "Person",
"@id":"https://www.coywolf.news/tamara-scott#Person"
@henshaw
henshaw / trademark-exceptions.php
Created August 14, 2021 00:43
WordPress Plugin Directory Trademark Abuse
// Domains from which exceptions would be accepted.
$trademark_exceptions = array(
'yoast.com' => array( 'yoast' ),
'automattic.com' => array( 'akismet', 'akismet-', 'jetpack', 'jetpack-', 'wordpress', 'wp-', 'woo', 'woo-', 'woocommerce', 'woocommerce-' ),
'facebook.com' => array( 'facebook', 'instagram', 'oculus', 'whatsapp' ),
'support.microsoft.com' => array( 'bing-', 'microsoft-' ),
'trustpilot.com' => array( 'trustpilot' ),
'microsoft.com' => array( 'bing-', 'microsoft-' ),
);
@henshaw
henshaw / qrcode-link.php
Created August 23, 2021 23:04
QR code for WordPress template
@henshaw
henshaw / qrcode-link.html
Created August 23, 2021 23:06
QR code HTML output
@henshaw
henshaw / qrcode.css
Created August 23, 2021 23:07
QR code CSS
.qrcode { display:none; }
/* Printer Friendly */
@media print {
.qrcode { display:block;text-align:center; }
}
@henshaw
henshaw / cloudflare-firewall-rule.txt
Created August 23, 2021 23:10
Cloudflare Firewall rule expression for blocking hotlinking for a specific folder
(http.request.full_uri contains "/path/to/qrcode/" and not http.referer contains "yourdomain.com")
@henshaw
henshaw / qr-code-generator.txt
Created August 24, 2021 01:48
Example QR code generator link
/wp-content/themes/coywolf/qrcode/php/qr_img.php?d=QR%20codes%20are%20fun"
@henshaw
henshaw / qr-code-script-path.txt
Created August 24, 2021 01:49
QR code generator script path
/wp-content/themes/coywolf/qrcode/php/qr_img.php
@henshaw
henshaw / functions.php
Last active October 19, 2021 14:25
The WordPress HTTP header must have cache-control set to must-revalidate for Signed Exchanges (SXG) to work with Cloudflare on Google Search. This code must be added to the theme's functions.php file. Additionally, the Browser Cache TTL on Cloudflare must be set to Respect Existing Headers.
/**
* Add cache-control headers to response
*/
function add_cache_control_headers() {
if (!is_admin()) {
header("Cache-Control: public, must-revalidate, max-age=3600");
}
}
add_action( 'template_redirect', 'add_cache_control_headers' );