Skip to content

Instantly share code, notes, and snippets.

View name_parser.php
<?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));
View header.php
<!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 Feb 10, 2019
Custom Image Widget JS file
View custom-media-image-widget.js
/* 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 Apr 21, 2021
This is a clone of the WP_Widget_Media_Image class that was introduced in WP version 4.8.0.
View custom_image_widget.php
<?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