Skip to content

Instantly share code, notes, and snippets.

View hirejordansmith's full-sized avatar

Jordan Smith hirejordansmith

View GitHub Profile
@hirejordansmith
hirejordansmith / events-recurring.php
Created December 18, 2016 12:34
Events Recurring with Thumbnail Support
<?php
/**
* Recurring Events
*
* @package BE-Events-Calendar
* @since 1.0.0
* @link https://github.com/billerickson/BE-Events-Calendar
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2014, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@hirejordansmith
hirejordansmith / custom.css
Last active December 6, 2016 15:12
NDR AMP Code
body { font-family: Arial, sans-serif; }
.amp-wp-header { background: none; overflow: hidden; }
.amp-wp-header div { overflow: hidden; padding-bottom: 0; }
.amp-wp-title, h2, h3, h4 { font-weight: 400; }
.amp-wp-header a.amp-logo {
background: url(https://302mzo3s6lif441niv3xmjco-wpengine.netdna-ssl.com/wp-content/themes/nationaldebtrelief/images/logo-280.png) no-repeat;
margin: 0;
padding: 0;
width: 150px;
height: 45px;
@hirejordansmith
hirejordansmith / insert-content-wordpress-after-certain-amount-paragraphs.php
Created December 6, 2016 13:59
Insert Content in WordPress after a certain amount of paragraphs
<?php
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code = '<div>Ads code goes here</div>';
if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}
return $content;
}
@hirejordansmith
hirejordansmith / insert-content-wordpress-after-certain-amount-characters-words.php
Created December 6, 2016 13:58
Insert Content in WordPress after a certain amount of characters or words
<?php
add_filter('the_content', 'hjs_insert_content_after_chars_words');
function hjs_insert_content_after_chars_words($content) {
// only do this if post is longer than 1000 characters
$enable_length = 1500;
// insert after the first </p> after 500 characters
$after_character = 1500;
if (is_single() && strlen($content) > $enable_length) {
$before_content = substr($content, 0, $after_character);
$after_content = substr($content, $after_character);
@hirejordansmith
hirejordansmith / app.js
Created November 22, 2016 10:45
Hash Tag Popup for WordPress
(function ($) {
"use strict";
/**
Creates an instance of Lightbox.
@constructor
@this {Lightbox}
@param {object} $container The container.
@param {object} opts Options.
@hirejordansmith
hirejordansmith / modify-input-mask-placeholders-gravity-forms.php
Last active June 1, 2018 05:11
How to Modify Input Mask Placeholders for Gravity Forms
<?php
/*
Gravity Wiz // Gravity Forms // How to Modify Input Mask Placeholders for Gravity Forms
http://gravitywiz.com/how-to-modify-input-mask-placeholders-for-gravity-forms/
*/
<script type="text/javascript">
setTimeout( function() {
jQuery( '#input_FORMID_FIELDID' ).mask( 'MASK', { placeholder: '' } );
}, 500 );
@hirejordansmith
hirejordansmith / create-product-bundles-by-adding-coupons-to-cart-dynamically-based-on-products-in-the-cart.php
Last active March 7, 2019 09:00
Create Product Bundles by adding coupons to cart dynamically based on products in the cart - WooCommerce
<?php
/**
* Hire Jordan Smith // Create Product Bundles by adding coupons to cart dynamically based on products in the cart
*
* @version 1.0
* @author Jordan Smith <jordan@hirejordansmith.com>
* @license GPL-2.0+
* @link http://hirejordansmith.com/...
* @copyright 2016 - Hire Jordan Smith
@hirejordansmith
hirejordansmith / add-coupon-dynamically-based-on-cart-subtotal-woocommerce.php
Last active December 10, 2019 21:07
Add A Coupon Dynamically based on Cart Subtotal with WooCommerce
<?php
/**
* @snippet Add A Coupon Dynamically based on Cart Subtotal with WooCommerce
* @sourcecode http://hirejordansmith.com
* @author Jordan Smith
* @compatible WooCommerce 2.4.7
*/
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
@hirejordansmith
hirejordansmith / woocommerce-class-values.php
Last active April 22, 2024 14:20
WooCommerce Class Values
<?php
// Returns subtotal price ($5.00)
$cart_subtotal = WC()->cart->get_cart_subtotal();
// Returns subtotal number value (5)
$cart_subtotal = WC()->cart->subtotal;
/*========================================
Single Product
@hirejordansmith
hirejordansmith / magnific-popup-gallery-image-plus-video.js
Last active December 6, 2023 22:28
How to show images and video in Magnific Popup Gallery