Skip to content

Instantly share code, notes, and snippets.

View wvfitzgerald's full-sized avatar
💭
Bug Hunting!

Bill Fitzgerald wvfitzgerald

💭
Bug Hunting!
View GitHub Profile
@wvfitzgerald
wvfitzgerald / delete-merged-branches.MD
Last active January 13, 2026 22:51
A bash script to safely delete remote Git branches that you created and have been fully merged into staging

Delete Merged Remote Branches

Distributed under GNU General Public License

A bash script to safely delete remote Git branches that you created and have been fully merged into staging. Sometimes it's just not practicle to have branches auto-delete when merged. For those occcasions I have written this simple script to cleanup the old branches that weren't deleted manually.

What It Does

This script finds and deletes remote branches that meet ALL of these criteria:

@wvfitzgerald
wvfitzgerald / content-switcher-example.html
Last active July 23, 2023 22:26
jQuery Content Switcher
<!-----
Our select options here should have a matching content block below, ex:
value="0" is accompanied by a div wiht the id "data_0"
ADD THIS CSS TO YOUR STyle SHEET:
#content_selector {
margin-bottom: 40px;
}
.hide {
<?php
/**
* Plugin Name: WP Allow unfiltered HTML
* Description: This plugin allows WP site admins (non super admins) to include arbitrary HTML in their posts in a multi-site network.
* Author: Bill Fitzgerald
* Version: 1.0
*/
/*---------Add unfiltered_html capabilities for normal (non-super) admins
<?php
/*
Plugin Name: Remove Custum CSS Option
Plugin URI: http://maxxpotential.com/
Description: Remove the custom css option from Customizer for non Super Admins
Author: Bill Fitzgerald
License: GPLv2 or later
*/
/*----Remvoe he custom CSS option from Customizer for site admins in a multi-site Netwrok----*/
function remove_css_customize_register()
<?php
/*----------
If our script could possibly already be enqueued by a theme or plugin but not globally
or we are not sure we can use wp_script_js to help ensure we don't enqueue it twice on
the same page. See the Codex for more info:
https://codex.wordpress.org/Function_Reference/wp_script_is
-------------*/
if (wp_script_is( 'script_handle', 'enqueued' )) {
return;
} else {
<?php
/*-----Disable comments on all Post and Pages-------*/
function mhs_comments_open( $open, $post_id ) {
$post = get_post( $post_id );
/*---If in the future we want comments on post
we will need to change it in this if statement----*/
if ( 'page' == $post->post_type || 'post' == $post->post_type )
@wvfitzgerald
wvfitzgerald / wp-menu-widget-mobile.php
Last active May 14, 2021 20:58
Converts the WordPress menu widget into a mobile menu button on mobile device, It could be easily adapted to other widgets as well.
<?php
/*--------
To make the WP core Navigation Menu widget a mobile nav button on mobile devices add this snippet to you themes
functions.php and In the Navigation Menu widget settings->Widget Styles->Attributes->Widget Class addd mhs-wvf-easy-mobile,
that all folks!
Thsi can be easily used/addapted to othet widgets as well
-----*/
function mhsWvfCollapseDefaultNavWidgetOLD()
{
?>
@wvfitzgerald
wvfitzgerald / wp-ajax-get-post.php
Last active May 12, 2021 19:31
Example of WordPress Ajax on the front end
<?php
/*---We can add this bit to to our theme's fuction.php or a custom plugin-----*/
function get_wp_posts() {
// Arguments: see docs for get_post @ https://developer.wordpress.org/reference/functions/get_posts/
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => 5,
);
@wvfitzgerald
wvfitzgerald / save-select-opitons.js
Created February 11, 2020 18:32
Save selected dropdown options fot the next visit.
var today = new Date();
var expiry = new Date(today.getTime() + 30 * 24 * 3600 * 1000); // plus 30 days
function setCookie(name, value)
{
var sel = document.getElementById("industry");
var value = sel.options[sel.selectedIndex].value;
document.cookie=name + "=" + value + "; path=/; expires=" + expiry.toGMTString();
}