Skip to content

Instantly share code, notes, and snippets.

View hellofromtonya's full-sized avatar

Tonya Mork hellofromtonya

View GitHub Profile
@hellofromtonya
hellofromtonya / mu_autoloader.php
Last active June 24, 2019 14:36
UpDevTools must-use autoloader.php file
<?php
require_once __DIR__ . '/UpDevTools/bootstrap.php';
@hellofromtonya
hellofromtonya / hard-unregister.php
Last active June 7, 2019 21:40
Hard Unregister for an Object's callback where you do not have access to the instance itself.
/**
* Do a hard unregister of an object's callback for the specified event name
* and priority level.
*
* In WordPress, the callback key (or unique ID) is generated using the hash ID of
* the object concatenated with the method name. In the event that you do not have
* the object itself, then we use this hard approach to first first the callback
* function and then do the remove.
*
* This process works for both filter and action events.
@hellofromtonya
hellofromtonya / binary_tree.md
Last active June 7, 2019 17:26
Finding the Height and Diameter in a Binary Search Tree

Finding the Diameter of a Binary Tree

What is the diameter?

The diameter of a binary tree (sometimes called the width) is the number of nodes on the longest path between two leaves in the binary tree.

Edge Cases

The diameter can occur through:

@hellofromtonya
hellofromtonya / functions.php
Created April 5, 2017 14:52
Change the CreativeWork itemtype microdata - Genesis.
<?php
// ..code removed for brevity.
add_filter( 'genesis_attr_entry', 'change_creative_work_itemtype', 15 );
/**
* Change the CreativeWork itemtype.
*
* @since 1.0.0
*
@hellofromtonya
hellofromtonya / functions.php
Created July 1, 2014 02:03
Remove Page Titles from all pages in Genesis
add_filter('genesis_post_title_output', 'lunarwp_remove_page_title', 10, 1);
/**
* Remove the Page Title section from all pages
*
* @since 1.0.0
*
* @return string Page Title or empty sting (for pages)
*/
function lunarwp_remove_page_title($output)
{
@hellofromtonya
hellofromtonya / post.php
Created December 16, 2016 19:04
remove the byline
add_action( 'loop_start', 'remove_post_byline' );
/**
* Remove the post metadata byline from the HTML markup.
*
* @since 1.0.0
*
* @return void
*/
function remove_post_byline() {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
@hellofromtonya
hellofromtonya / post.php
Created December 16, 2016 21:04
remove a callback hook using a shortcut strategy
add_action( 'genesis_entry_header', 'remove_post_byline', 9999 );
/**
* Remove the post metadata byline from the HTML markup.
*
* @since 1.0.0
*
* @return void
*/
function remove_post_byline() {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
@hellofromtonya
hellofromtonya / taxonomy.php
Created January 19, 2017 20:28
Registering a custom taxonomy
<?php
/**
* Custom Taxonomy functionality
*
* @package KnowTheCode\TeamBios\Custom
* @since 1.0.0
* @author hellofromTonya
* @link https://knowthecode.io
* @license GNU General Public License 2.0+
*/
@hellofromtonya
hellofromtonya / footer.php
Created January 25, 2017 23:57
prefooter cta widget example
@hellofromtonya
hellofromtonya / portfolio-details-metabox.php
Last active April 17, 2019 02:19
Portfolio Details Metabox example
<?php
/**
* Portfolio Details Metabox Handler
*
* @package KnowTheCode\Portfolio\Metabox
* @since 1.0.0
* @author hellofromTonya
* @link https://KnowTheCode.io
* @license GPL-2.0+
*/