Skip to content

Instantly share code, notes, and snippets.

View rgadon107's full-sized avatar

Robert Gadon rgadon107

  • St. Louis, MO USA
View GitHub Profile
<?php
/**
* Enqueue child theme assets.
*
* @package yogaStLouis\utilityPro\Functions
* @link http://www.carriedils.com/utility-pro
* @author Carrie Dils
* @copyright Copyright (c) 2015, Carrie Dils
* @license GPL-2.0+
*/
@rgadon107
rgadon107 / gist:bf504a9fbcc8c11da3a02f6620746f84
Created June 27, 2017 19:35
Popup Maker Code Snippet - Footer Script to Reclick Last Clicked Link
<?php
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
/**
* Reclick the last clicked link upon form submission.
*
* @since v1.0.0
*
* @return void
*/
@rgadon107
rgadon107 / gist:72f5aec2ee74fb4dcfe81b63a49ef6e0
Last active July 11, 2017 18:13
Popup Maker Code Gist for theme functions.php file for 'royaltruckandequipment.com'
<?php
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
function my_custom_popup_scripts() { ?>
<script type="text/javascript">
(function ($, document, undefined) {
$('#popmake-2686 .pum-content a').click(function (e) { $('#popmake-2686').trigger('pumSetCookie'); });
@rgadon107
rgadon107 / Set Cookie on Form Submit and Close
Created July 19, 2017 01:17
Custom function to pass in a jQuery script to set a cookie via manual JS during 'on_click' trigger event and on form close.
@rgadon107
rgadon107 / single-event.php
Created August 19, 2018 03:41
Render an event venue when calling 'single-event.php'.
add_action( 'genesis_entry_header', __NAMESPACE__ . '\add_content_wrap_markup_open', 3 );
/*
* Add content wrap around Event entry_header & render post thumbnail on single.
*
* @since 1.0.0
*
* return void
*/
function add_content_wrap_markup_open() {
$event_id = (int) get_the_ID();
@rgadon107
rgadon107 / setup-phpunit.sh
Created March 30, 2020 06:19 — forked from keesiemeijer/setup-phpunit.sh
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@rgadon107
rgadon107 / code-challenge-1.php
Last active January 26, 2021 21:52
Solution to Code Challenge 1 from "Refactoring Tweaks Workbook"
// # Code Challenge 1, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ).
// ## Original code to be refactored
/**
* Check if custom post type exists, to provide data
*/
function prefix_is_post_type( string $type, int $post_id ) {
global $wp_query;
if($type == get_post_type($wp_query->post->ID)) return true;
@rgadon107
rgadon107 / code-challenge-2.php
Created January 27, 2021 02:03
Solution to Code Challenge 2 from "Refactoring Tweaks Workbook"
/* Code Challenge 2, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
/* This function grabs the custom header from the current theme so that it can be displayed. */
@rgadon107
rgadon107 / code-challenge-3.php
Last active January 27, 2021 21:52
Solution to Code Challenge 3 from "Refactoring Tweaks Workbook"
/* Code Challenge 3, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
class Form {
@rgadon107
rgadon107 / code-challenge-5.php
Created January 29, 2021 21:43
Solution to Code Challenge 5 from "Refactoring Tweaks Workbook"
/* Code Challenge 5, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
class Session {