Skip to content

Instantly share code, notes, and snippets.

View jstnbr's full-sized avatar

Justin Breen jstnbr

View GitHub Profile
@jstnbr
jstnbr / functions.php
Created January 1, 2023 15:43 — forked from adeel-raza/functions.php
A very simple function to execute custom JS after an ajax request with a specific WordPress action is triggered
<?php
add_action( 'wp_enqueue_scripts', 'myprefix_add_custom_js');
function myprefix_add_custom_js() {
wp_add_inline_script( 'jquery',
'
jQuery(function($) {
/**
* catch AJAX complete events, to catch wordpress actions
@jstnbr
jstnbr / taxonomy-slug-as-custom-post-type.php
Created November 5, 2022 20:05 — forked from fomigo/taxonomy-slug-as-custom-post-type.php
wp: CUSTOM TAXONOMY WITH SAME SLUG AS CUSTOM POST TYPE
<?php
/*
* Source: http://someweblog.com/wordpress-custom-taxonomy-with-same-slug-as-custom-post-type/
*/
// rewrite urls
function taxonomy_slug_rewrite($wp_rewrite) {
$rules = array();
@jstnbr
jstnbr / add-wordpress-settings-page.php
Created August 20, 2022 22:54 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@jstnbr
jstnbr / wp-disable-plugin-update.php
Created April 25, 2022 14:44 — forked from rniswonger/wp-disable-plugin-update.php
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@jstnbr
jstnbr / GitCommitEmoji.md
Created October 15, 2020 16:45 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@jstnbr
jstnbr / youtube_id_regex.php
Created April 10, 2020 04:11 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@jstnbr
jstnbr / install_ngrok.sh
Created March 12, 2020 01:14 — forked from ZachBray/install_ngrok.sh
ngrok install
#!/bin/bash
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
rm ngrok-stable-linux-amd64.zip
sudo mv ngrok /usr/bin/
@jstnbr
jstnbr / Mailhog Bash Script (systemd)
Created March 11, 2020 20:53 — forked from v-jacob/Mailhog Bash Script (systemd)
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
@jstnbr
jstnbr / Unbuntu1604-LEMP.sh
Created March 11, 2020 20:53 — forked from blantonious/Unbuntu1604-LEMP.sh
Configuration script to prep and install Laravel 5.6 on Ubuntu 16.04
#!/bin/bash
# /*=================================
# = VARIABLES =
# =================================*/
WELCOME_MESSAGE='
____ ____ ____ ____ ____
||N ||||G ||||I ||||N ||||X ||
||__||||__||||__||||__||||__||
@jstnbr
jstnbr / Magnific Popup - Youtube.html
Created February 13, 2020 00:00 — forked from philbar/Magnific Popup - Youtube.html
Runs a Youtube Video in Magnific Popup.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//www.youtube.com/iframe_api"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/jquery.magnific-popup.min.js"></script>
<script>
$(document).ready(function() {
// Initializes Magnific Popup
$('#lp-pom-image-202 a, #lp-pom-box-218 a, #lp-pom-box-217 a').magnificPopup({
disableOn: 700,