Skip to content

Instantly share code, notes, and snippets.

@jaredatch
jaredatch / mailhog-mamp.md
Created January 30, 2018 21:57
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
@jaredatch
jaredatch / functions.php
Last active October 16, 2023 11:51
WPForms display form entries with a custom shortcode
<?php
/**
* Custom shortcode to display WPForms form entries.
*
* Basic usage: [wpforms_entries_table id="FORMID"].
*
* Possible shortcode attributes:
* id (required) Form ID of which to show entries.
* user User ID, or "current" to default to current logged in user.
* fields Comma seperated list of form field IDs.
@jaredatch
jaredatch / custom-validation.js
Last active September 7, 2023 15:45
WPForms adding a custom validation rule
;(function($) {
var JA_Custom_Validation = {
/**
* Start the engine.
*
* @since 1.0.0
*/
init: function() {
@jaredatch
jaredatch / how-to.txt
Last active July 20, 2023 17:46
WPForms prevent duplicate / double form entry submissions
<script type="text/javascript">
/**
* Prevent double entry submissions.
*
* Steps to install:
* ​1 - Download and activate the "Insert Headers and Footers" plugin (by WPBeginner)
* 2 - Go to Settings > Insert Headers and Footers
* 3 - Paste this entire code snippet
* 4 - Save
*/
@jaredatch
jaredatch / functions.php
Last active July 3, 2023 23:10
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@jaredatch
jaredatch / phpcs-mamp.md
Created February 12, 2018 18:06
Install PHPCS with MAMP Pro

Install PHPCS with MAMP Pro

PHPCS

There are different ways to install PHPCS, the method below uses PEAR which installs it within your PHP installation.

First, locate the active MAMP Pro PHP installation.

$ which php
@jaredatch
jaredatch / gist:5645033
Last active February 4, 2023 12:51
Modify/change the default allowed tags for bbPress.
<?php
/**
* Modify/change the default allowed tags for bbPress.
*
* The default list (below) is in bbpress/includes/common/formatting.php, L24-66.
* Adjust below as needed. This should go in your theme's functions.php file (or equivilant).
*/
function ja_filter_bbpress_allowed_tags() {
return array(
<?php
/**
* Dont Update the Theme
*
* If there is a theme in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @param array $r Existing request arguments
* @param string $url Request URL
* @return array Amended request arguments
<?php
/**
* Create ACF setting page under Events CPT menu
*
* @since 1.0.0
*/
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(array(
'title' => 'Event Settings',
'parent' => 'edit.php?post_type=events',
@jaredatch
jaredatch / header-default.php
Last active August 8, 2022 19:55
WPForms Email template with WHITE background
<?php
/**
* Directions to install:
*
* - Inside your WordPress theme, create a directory named "wpforms-email"
* - Within this new directory, create a file named "header-default.php" and paste this file
* - That's it!
*/
// Exit if accessed directly