Skip to content

Instantly share code, notes, and snippets.

View BinaryMoon's full-sized avatar
🏠
Working from home

Ben Gillbanks BinaryMoon

🏠
Working from home
View GitHub Profile
@BinaryMoon
BinaryMoon / bunny-hop.php
Created July 8, 2022 19:36
Change Google fonts for Bunny Fonts
<?php
/**
* Plugin Name: Bunny Hop.
* Plugin URI: https://prothemedesign.com
* Description: Swap Google fonts for Bunny Fonts to make the fonts GDPR compliant.
* Author: Ben Gillbanks
* Version: 1.0
* Author URI: https://prothemedesign.com
*/
@BinaryMoon
BinaryMoon / chronicle-featured-content.php
Created May 5, 2021 20:33
Change Chronicle Featured Content
@BinaryMoon
BinaryMoon / grandchild.php
Created April 28, 2021 22:22
Create a plugin that loads template files from a plugin
<?php
/**
* Plugin Name: Grandchild Theme
* Description: Load template files from a plugin.
* Author: Ben Gillbanks
* Version: 1.0.0
* Author URI: https://prothemedesign.com
*
* @package grandchild
*/
@BinaryMoon
BinaryMoon / broadsheet-thumnail-size.php
Created April 21, 2021 11:16
Change thumbnail sizes in the Broadsheet theme
<?php
/**
* Plugin Name: Change Archive Image Thumbnail size.
* Plugin URI: https://prothemedesign.com
* Description: Change the size of the archive image thumbnails so that they can be made full width.
* Author: Ben Gillbanks
* Version: 1.0
* Author URI: https://prothemedesign.com
* Text Domain: broadsheet
*/
@BinaryMoon
BinaryMoon / buffer-example.php
Last active March 26, 2021 22:45
Example of using the buffer ip
<?php
// Uses: https://github.com/thewebguy/bufferapp-php/blob/master/buffer.php
$buffer = new BufferApp( $client_id, $client_secret, $callback_url );
$buffer->set_access_token( $access_token );
$buffer->go(
'/updates/create',
array(
'text' => $message,
@BinaryMoon
BinaryMoon / maze.php
Created March 26, 2021 22:40
A PHP maze generator
<?php
/**
* Maze.php
*
* Based on: https://github.com/chimericdream/PHP-Maze-Generator/blob/master/Maze.php
* This file contains the declaration for the Maze class.
*
* @file Maze.php
* @author Bill Parrott <bparrott@ku.edu>
* @date 11/30/2012
<?php
/**
* Plugin Name: Gutenberg Image Alignment
* Plugin URI: https://prothemedesign.com
* Description: Fix image alignment classes in Gutenberg.
* Author: Ben Gillbanks
* Version: 1.0
* Author URI: https://prothemedesign.com
*
* @package ptd
@BinaryMoon
BinaryMoon / scrollbar.css
Created November 17, 2020 19:35
Scrollbar width and height sizing
::-webkit-scrollbar {
width: 0.5rem;
height: 0.5rem;
background-color: $mid-grey;
border-radius: 1rem;
}
::-webkit-scrollbar-thumb {
@BinaryMoon
BinaryMoon / the_content_filter.php
Last active October 27, 2020 14:41
Only execute the_content on the_content and not the_excerpt
<?php
function example( $content ) {
/**
* Only add social sharing links to the_content and not content passed through get_the_excerpt.
*/
global $wp_current_filter;
if ( in_array( 'get_the_excerpt', $wp_current_filter, true ) ) {
@BinaryMoon
BinaryMoon / bm_var_dump.php
Created September 29, 2020 19:40
A custom var_dump inspired
<?php
/**
* A custom var_dump that wraps the content in pre elements so it's easier to read.
* Inspired by: https://twitter.com/wpmark/status/1310870151483584514
*
* @param mixed $things A variable length list of things to be output.
* @return void
*/
function bm_var_dump( ...$things ) {