Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Gillbanks BinaryMoon

View GitHub Profile
@BinaryMoon
BinaryMoon / bunny-hop.php
Created Jul 8, 2022
Change Google fonts for Bunny Fonts
View bunny-hop.php
<?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
Change Chronicle Featured Content
View chronicle-featured-content.php
@BinaryMoon
BinaryMoon / grandchild.php
Created Apr 28, 2021
Create a plugin that loads template files from a plugin
View grandchild.php
<?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 Apr 21, 2021
Change thumbnail sizes in the Broadsheet theme
View broadsheet-thumnail-size.php
<?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 Mar 26, 2021
Example of using the buffer ip
View buffer-example.php
<?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 Mar 26, 2021
A PHP maze generator
View maze.php
<?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
View gutenberg-image-alignment.php
<?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 Nov 17, 2020
Scrollbar width and height sizing
View scrollbar.css
::-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 Oct 27, 2020
Only execute the_content on the_content and not the_excerpt
View the_content_filter.php
<?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 Sep 29, 2020
A custom var_dump inspired
View bm_var_dump.php
<?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 ) {