Skip to content

Instantly share code, notes, and snippets.

View devinsays's full-sized avatar

Devin Price devinsays

View GitHub Profile
@devinsays
devinsays / class-nf-hubspot.php
Created January 25, 2018 23:42
Custom Ninja Forms + Hubspot integration.
<?php
/**
* Hubspot Integration for Ninja Forms.
*
* @package Nano
*/
class NF_Hubspot {
// Hooks into ninja_forms_after_submission
public function init() {
@devinsays
devinsays / class-nano-user-meta.php
Last active December 28, 2017 20:58
Adds meta fields to account profiles for business_account (wholesale) meta.
<?php
/**
* Add extra profile fields for users in admin.
*
* @author Nano
* @version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
@devinsays
devinsays / animationsInit.js
Created December 5, 2017 23:49
More detail on how to use scroll reveal with data attributes in a WordPress theme.
/*!
* Script for initializing globally-used functions and libs.
*
* @since 1.0.0
*/
(function($) {
var theme = {
// Init functions
@devinsays
devinsays / class-nano-trial-subscription.php
Created December 5, 2017 18:07
Add a trial subscription product to the cart during order processing.
<?php
/**
* When a trial product is purchased we add a subscription product the order
* directly before order processing.
*
* This subscription order charges after 14 days if customer does not cancel.
*/
class Nano_Trial_Subscription {
@devinsays
devinsays / is-returning-customer.php
Created December 1, 2017 17:55
Checks to see if customer email has been used to place an order.
<?php
/**
* Checks if e-mail address has been used previously for a purchase.
*
* @param string $email of customer
* @return boolean
*/
function is_returning_customer( $email ) {
$customer_orders = wc_get_orders( array(
@devinsays
devinsays / set-cookie-wordpress.php
Last active May 19, 2024 19:18
How to set a cookie using PHP in WordPress
@devinsays
devinsays / class-trial-subscription.php
Last active February 7, 2021 15:08
Creates a subscription in the background when a trial product is purchased.
<?php
/**
* When a trial product is purchased we create an order for a subscription product.
*
* This subscription order charges after 14 days if customer does not cancel.
*/
class Nano_Trial_Subscription {
/**
@devinsays
devinsays / wordpress-version-compare.php
Last active November 14, 2017 21:10
Example code for checking WordPress versions.
<?php
get_bloginfo( 'version' );
global $wp_version;
if ( version_compare( $wp_version, '4.3', '>=' ) ) {
// WordPress version is greater than 4.3
}
if ( function_exists( 'has_post_format' ) ) {
@devinsays
devinsays / customizer-default-sections.php
Created November 10, 2017 03:56
Theme Customizer Default Sections
<?php
$this->add_section( 'title_tagline', array(
'title' => __( 'Site Title & Tagline' ),
'priority' => 20,
) );
$this->add_section( 'title_tagline', array(
'title' => __( 'Site Title & Tagline' ),
'priority' => 20,
@devinsays
devinsays / portfolio-post-type-gist.php
Created November 10, 2017 03:44
Portfolio Post Type Gist
<?php
/*
Plugin Name: Portfolio Post Type Gist
Plugin URI: https://wptheming.com
Description: Enables a portfolio post type and taxonomies.
Version: 0.1
Author: Devin Price
Author URI: https://wptheming.com/portfolio-post-type/
License: GPLv2
*/