Skip to content

Instantly share code, notes, and snippets.

<div class="logo"><a href="/"><?php bloginfo('name'); ?></a></div>
"breadcrumb": {
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "https://www.coywolf.news",
@henshaw
henshaw / accessible-number-input.html
Created April 7, 2021 16:40
Accessible number input
<input type="text" pattern="[0-9]*" inputmode="numeric">
@henshaw
henshaw / gravatar-alt-author-wordpress.php
Created July 18, 2021 15:54
Add ALT attribute with author name to Gravatar image in WordPress – Copy to functions.php
// Adds ALT attribute with author name to Gravatar image in WordPress
function replace_content($text)
{
$alt = get_the_author_meta( 'display_name' );
$text = str_replace('alt=\'\'', 'alt=\''.$alt.'\'',$text);
return $text;
}
add_filter('get_avatar','replace_content');
@henshaw
henshaw / gist:5cf736e248e0f0edd6a1e195b9bd6852
Created July 21, 2021 00:42
WordPress WebP quality setting - Save in functions.php
// Use a quality setting of 75 for WebP images.
function filter_webp_quality( $quality, $mime_type ) {
if ( 'image/webp' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 );
@henshaw
henshaw / external-link-style-image.css
Last active August 7, 2021 03:40
External link style that displays image/icon after the text
@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 / 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 / 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 / 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")