Skip to content

Instantly share code, notes, and snippets.

@jaredatch
jaredatch / functions.php
Created Oct 12, 2020
Display WPForms entries count
View functions.php
<?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 Jun 7, 2018
Pin button overlays for content images
View _pin_it.scss
/* Pinterest images */
.pin-it-image {
display: block;
position: relative;
img {
display: block;
}
@jaredatch
jaredatch / wpforms-input-masks.md
Last active Mar 15, 2021
WPForms Input Masks
View wpforms-input-masks.md

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 Feb 12, 2018
Install PHPCS with MAMP Pro
View phpcs-mamp.md

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 Feb 8, 2018
WPForms manually run the 1.4.3 entries database upgrade routine
View functions.php
<?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 Feb 6, 2018
WPForms limit form entries
View functions.php
<?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 Feb 6, 2018
WPForms register/create new smart tag
View functions.php
<?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 Jan 30, 2018
Install MailHog with MAMP Pro
View mailhog-mamp.md

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 Jan 28, 2020
Install Pimp my Log with MAMP Pro (for use with WordPress development)
View pimp-my-log-mamp-pro.md

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
WPForms dynamic choices display by category
View functions.php
<?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