Skip to content

Instantly share code, notes, and snippets.

View uamv's full-sized avatar
🏠
Working from home

Joshua Vandercar uamv

🏠
Working from home
View GitHub Profile
@uamv
uamv / pinterest-board-alphabetize.js
Last active April 17, 2017 18:54
Adds a button to Pinterest profiles allowing the alphabetizing of boards.
// Using an object literal for a jQuery feature
var alphaBoards = {
init: function( settings ) {
alphaBoards.setup();
if ( $('.ownProfile').length ) {
alphaBoards.config = {
parentSelector: ".UserBoards.ownProfile div:first-child .GridItems",
childSelector: "div.item",
keySelector: "div a.boardLinkWrapper",
@uamv
uamv / append-series-list.php
Last active September 4, 2015 15:44
Append Series List to WordPress Posts
<?php
add_filter( 'the_content', 'uamv_series_list', 2 );
function uamv_series_list( $content ) {
// associative array with seriesName => array of post IDs
$series = array(
'#MissionText' => array( 5671, 5691, 5741, 5814 ),
'Prayer' => array( 171, 220, 235, 237, 239, 241, 3890 ),
);
@uamv
uamv / gf-enter-prevent-submission.php
Last active May 22, 2019 08:14
Disables form submission when pressing Enter, unless user has tabbed to submit button or page advance button.
<?php
function twxyz_prevent_gform_submission( $form ) { ?>
<script type="text/javascript">
jQuery(document).bind('gform_post_render', function(){
jQuery(document).on( 'keypress', '.gform_wrapper', function (e) {
var code = e.keyCode || e.which;
if ( code == 13 && ! jQuery( e.target ).is( 'textarea,input[type="submit"],input[type="button"]' ) ) {
e.preventDefault();
return false;
@uamv
uamv / mainwp-client-report-monthly.html
Created July 7, 2017 14:58
HTML Text Used for MainWP Monthly Client Report
<table style="width: 600px; margin: 0 auto; padding: 0; border-spacing: 0; border-collapse: collapse;"><tbody><tr><td style="background: #040404; margin-top: 0; padding: 0;"><img style="display: block; border: 0; line-height: 1;" src="https://typewheel.xyz/share/typewheel-email-banner.png" alt="Typewheel" width="600" /></td></tr><tr><td style="padding: 2em; background-image: linear-gradient( to bottom, #D7D7D7, #E7D3BA);"><p style="margin: 0 2em 2em;">Hello [client.contact.nickname]! Here's an overview of the things I am doing to keep your site updated, optimized, and secure.</p><p style="text-align: center; margin: 0 0 1.5em;"><img style="display: block; margin: 0 auto .5em;" src="[client.logo.url]" alt="[client.name] Logo" height="100" /><span style="text-align: center; font-size: 28px;"><strong>[report.daterange]</strong></span><br /><span style="text-align: center; font-size: 28px;"><strong><a style="color: #040404; text-decoration: none;" href="[client.site.url]">[client.site.domain]</a></strong></span><
@uamv
uamv / Serialized_Post_Meta_Datastore.php
Created October 5, 2017 13:02
The following class allows you to store post meta fields as a serialized array instead of multiple database rows.
<?php
use Carbon_Fields\Field\Field;
use Carbon_Fields\Datastore\Datastore;
/**
* Stores serialized values in the database
*/
class Serialized_Post_Meta_Datastore extends Datastore {
@uamv
uamv / suppress-gutenberg-teaser
Created March 23, 2018 21:10
Suppress Gutenberg Teaser in WP 4.9.5
add_action( 'admin_init', 'typewheel_remove_gutenberg_teaser' );
function typewheel_remove_gutenberg_teaser() {
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
}
@uamv
uamv / suppress-privacy-notice-pointer-wp496
Last active May 22, 2018 03:50
Run once to automatically dismiss the Privacy Notice pointer in WP 4.9.6 for all users.
add_action( 'admin_init', 'typewheel_remove_privacy_notice_pointer_wp496' );
function typewheel_remove_privacy_notice_pointer_wp496() {
$users = get_users();
foreach ( $users as $user ) {
$dismissed = array_filter( explode( ',', (string) get_user_meta( $user->ID, 'dismissed_wp_pointers', true ) ) );
$pointer = 'wp496_privacy';
@uamv
uamv / typewheel-itsec-notification-center-assistant.php
Created July 26, 2018 03:20
Enhances your control of the iThemes Security Control Center options
add_action('admin_footer', 'typewheel_notification_assistant' );
function typewheel_notification_assistant() {
// Add script if current screen belongs to iThemes Security
if ( get_current_screen()->id == 'toplevel_page_itsec' ) { ?>
<script>
let myUser = '';
@uamv
uamv / gf-map-class-to-post-meta.php
Last active January 22, 2024 10:54
Save Gravity Form field data to post meta by adding a class to the field.
<?php
/**
* Save Gravity Form field data to post meta by adding a class to any field.
* Meta is mapped so that it is readable by Advanced Custom Fields
* Format class as…
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record
* post_meta-{meta_key}-.3 -- for multi-input fields
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF
*/
// Run this function after the Gravity Form has created a post
@uamv
uamv / gf-custom-merge-tags.php
Last active May 26, 2022 01:12
Add custom merge tags to Gravity Forms
<?php
add_filter( 'gform_replace_merge_tags', 'typewheel_custom_merge_tags', 10, 7 );
function typewheel_custom_merge_tags( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
$custom_merge_tags = array(
'{date_ymd}' => date( 'Y.m-M.d', strtotime( $entry['date_created'] ) ),
'{timestamp}' => time(),
'{site_url}' => get_site_url(),
'{site_name}' => get_bloginfo( 'name' )