Skip to content

Instantly share code, notes, and snippets.

View chrismcintosh's full-sized avatar

Chris Mcintosh chrismcintosh

View GitHub Profile
<?php
/**
* WC Ajax Product Filter by Category
*/
if (!class_exists('WCAPF_Tag_Filter_Widget')) {
class WCAPF_Tag_Filter_Widget extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
<?php
/*
Change cancellation to set expiration date for next payment instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.)
function toggle(id) {
var e = document.getElementById(id);
if( e.style.display == 'block' || getComputedStyle(e, null).display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
// get all instances of a form on the post
const matches = document.querySelectorAll(".gform_wrapper form")
// we are using vue.js here with the slug of the current post in state
const slug = store.state.currentPost.slug
// loop through each form on the post
matches.forEach(function(match) {
// get the value of the id of the form
let gformID = match.getAttribute("id")
// get only the form number off the gravity form using regex
let isolatedID = /([1-9][0-9]*)/.exec(gformID)
dig +short myip.opendns.com @resolver1.opendns.com
import Bowser from "bowser"
const bowser = Bowser.parse(window.navigator.userAgent)
document.addEventListener("DOMContentLoaded", function(){
document.body.classList.add(`browser-${bowser.browser.name.toLowerCase()}`)
document.body.classList.add(`os-${bowser.os.name.toLowerCase()}`)
document.body.classList.add(`platform-${bowser.platform.type.toLowerCase()}`)
});
@chrismcintosh
chrismcintosh / manual-gravity-forms
Created April 20, 2020 15:39 — forked from keithdevon/manual-gravity-forms
Manually create entries and send notifications with Gravity Forms
<?php
// Manually create entries and send notifications with Gravity Forms
$form_id = 10;
// add entry
$entry = array(
"form_id" => $form_id,
"1" => "Entry for field ID 1",
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
# This is a basic workflow to help you get started with Actions
name: Deploy Production
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]