Skip to content

Instantly share code, notes, and snippets.

View StuffieStephie's full-sized avatar

Stephanie Q StuffieStephie

View GitHub Profile
<?php
/*--------------------------------------------------------------
# Dependancies
--------------------------------------------------------------*/
if (!function_exists('mb_strlen')) {
function mb_strlen($input) {
if (preg_match('!!u', $input)) {
// this is utf-8
return strlen( utf8_decode($input));
@StuffieStephie
StuffieStephie / header.php
Created November 1, 2017 14:45
WP OG Tags
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
$meta = array(
"title" => get_bloginfo( 'title' ),
"desc" => get_bloginfo( 'description'),
"url" => home_url( $_SERVER['REQUEST_URI'] ),
@StuffieStephie
StuffieStephie / custom-media-image-widget.js
Last active February 10, 2019 06:24
Custom Image Widget JS file
/* eslint consistent-this: [ "error", "control" ] */
/**
* Continued from PHP Instructions on renaming / cloning image class.
* @link https://gist.github.com/StuffieStephie/4f654058545d693787a36e76d3521b1e
*
* Step 1:
* Assign previewTemplate variable to the script template ID defined in the
* PHP file sans 'tmpl-' (Step 6 of PHP instructions)
@StuffieStephie
StuffieStephie / custom_image_widget.php
Last active April 21, 2021 17:56
This is a clone of the WP_Widget_Media_Image class that was introduced in WP version 4.8.0.
<?php
/**
* This is a clone of the WP_Widget_Media_Image class that was introduced
* in WP version 4.8.0.
*
* By cloning this class we can add new fields without modifying the original
* class. This means we can extend it to do whatever we want :D
*
* @package WordPress
* @subpackage Widgets