Skip to content

Instantly share code, notes, and snippets.

View seezee's full-sized avatar

Chris J. Zähller seezee

View GitHub Profile
@seezee
seezee / social.php
Last active January 4, 2022 16:01
Filter to add lightweight social sharing to WP Genesis themes. Include via functions.php.
<?php
/**
* Social sharing buttons meta to Genesis.
*
* @package There is no package.
* @since 1.0.0
*/
// Security.
if ( ! defined( 'ABSPATH' ) ) {
@seezee
seezee / disable-wp-nav-link.js
Last active December 1, 2021 18:21
Disabled WordPress Navigation Links
@seezee
seezee / add-rel-to-images.php
Last active November 17, 2021 22:28
2 different ways to add rel="noopener noreferrer" to linked images in WordPress. Could be improved with a check for external links so we can also add "external".
<?php
/**
* Plugin Name: Add Rel to Images
* Description: Add rel="noopener noreferrer" to linked images.
*
* @package There is no package.
*/
/**
* With jQuery.
<?php
/**
* Displays the post modified date.
*
* @package There is no package.
*/
/**
* Returns the last modified date for the post with the <time> tag and the
* time zone.
@seezee
seezee / feed-offset-template.php
Last active November 25, 2022 22:28
Customized WordPress RSS Feed. REPLACE the value of the variable $date before employing!
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
* Adds an offset of "1" to display all but most recent
*
* Full details at:
* https://wordimpress.com/anatomy-advanced-wordpress-blog-notification-email
*
* @package Your Package Name
*/
@seezee
seezee / webp.php
Last active November 25, 2022 22:28
WEBP for WordPress
<?php
/**
* Support for WEBP.
*
* @package myplugin
*/
// Security.
if ( ! defined( 'ABSPATH' ) ) {
die( 'Sorry, you are not allowed to access this page directly.' );
@seezee
seezee / rating-shortcode.php
Last active November 16, 2021 16:21
WordPress shortcode for accessible "Fontawesome 5" star ratings.
<?php
function my_rating( $atts ) {
$rating = shortcode_atts( array(
'stars' => '',
'half' => 'false',
), $atts );
$star = esc_attr($rating['stars']);
$stars = str_repeat('<i class="fas fa-fw fa-star"></i>', $star);
$half = esc_attr($rating['half']);