Skip to content

Instantly share code, notes, and snippets.

@jaredatch
jaredatch / functions.php
Created October 12, 2020 22:43
Display WPForms entries count
<?php
/**
* Custom shortcode to display WPForms form entries count for a form.
*
* Basic usage: [wpf_entries_count id="FORMID" type="TYPE"].
*
* @param array $atts Shortcode attributes.
*
* @return string
*/
@jaredatch
jaredatch / _pin_it.scss
Created June 7, 2018 14:20
Pin button overlays for content images
/* Pinterest images */
.pin-it-image {
display: block;
position: relative;
img {
display: block;
}
@jaredatch
jaredatch / wpforms-input-masks.md
Last active September 9, 2024 09:12
WPForms Input Masks

Basic Masks

Basic input masks use symbols to create the mask.

  • 9: Numeric
  • a: Alphabetical
  • A: Alphabetical (forces uppercase)
  • *: Alphanumeric
  • &: Alphanumeric (forces uppercase)
@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 / functions.php
Created February 8, 2018 16:57
WPForms manually run the 1.4.3 entries database upgrade routine
<?php
/**
* Manually run the v1.4.3 entries upgrade routine.
*
*/
function wpf_v143_upgrade_manual() {
// Fetch all entries.
$entries = wpforms()->entry->get_entries(
array(
@jaredatch
jaredatch / functions.php
Created February 6, 2018 04:18
WPForms limit form entries
<?php
/**
* Check entry limit, if past limit display a message.
*
* @param array $form_data
* @param object $form
*/
function wpf_form_check_entry_limit( $form_data, $form ) {
global $wpf_form_open;
@jaredatch
jaredatch / functions.php
Last active February 6, 2018 03:58
WPForms register/create new smart tag
<?php
/**
* Registers the Request URI smart tag.
*
* @param array $tags
* @return array
*/
function wpf_smarttag_request_uri_register( $tags ) {
$tags['request_uri'] = 'Request URI';
@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 / pimp-my-log-mamp-pro.md
Last active January 28, 2020 04:35
Install Pimp my Log with MAMP Pro (for use with WordPress development)

Install Pimp My Log with MAMP Pro (for use with WordPress development)

Pimp my Log

  1. Enable PHP logging in MAMP Pro, under the PHP settings (screenshot)

  2. Inside your MAMP Sites directory (or equivalent), create a new directory pimpmylog

  3. Create a new host, such as phplog.local, in MAMP for easy access (screenshot)

@jaredatch
jaredatch / functions.php
Created May 15, 2017 21:46
WPForms dynamic choices display by category
<?php
/**
* Narrow down post displayed by category.
*
* See https://codex.wordpress.org/Template_Tags/get_posts
*
* @param array $args
* @param array $field
* @param int $form_id
* @return array