Skip to content

Instantly share code, notes, and snippets.

View Twanneman's full-sized avatar

Twanneman Twanneman

View GitHub Profile
@cliffordp
cliffordp / functions.php
Last active November 6, 2024 20:50
Event Tickets Plus: WooCommerce: Force all tickets to be "Sold Individually".
<?php
/**
* Event Tickets Plus: WooCommerce: Force all tickets to be "Sold Individually".
*
* By default, this limits the purchase quantity to 1, but this is quantity is
* filterable with `woocommerce_add_to_cart_sold_individually_quantity`.
*
* @see Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_event_for_ticket()
* @see WC_Product::is_sold_individually()
* @see WC_Cart::add_to_cart()
@spivurno
spivurno / gp-post-content-merge-tags-support-plus-signs.php
Created March 28, 2018 16:14
Gravity Perks // GP Post Content Merge Tags // Support Plus Signs when Populating a Form
<?php
/**
* Gravity Perks // GP Post Content Merge Tags // Support Plus Signs when Populating a Form
* https://gravitywiz.com/documentation/gravity-forms-post-content-merge-tags/
*/
add_filter( 'shortcode_atts_gravityforms', function( $out, $pairs, $atts, $shortcode ) {
if( isset( $out['field_values'] ) ) {
$out['field_values'] = str_replace( '+', '%2B', $out['field_values'] );
}
@ben-heath
ben-heath / breadcrumb-shortcode.php
Created March 14, 2018 20:17
Short to add breadcrumb
function breadcrumbs() {
global $post;
ob_start();
// Code
if(!is_home()) {
$breadcrumb = '<nav class="breadcrumb">';
$breadcrumb .= '<a href="'.home_url('/').'">Home</a><span class="divider"> / </span>';
if (is_category() || is_single()) {
$breadcrumb .= the_category(' <span class="divider"> / </span> ');
if (is_single()) {
@codytooker
codytooker / acf-sync-user-and-cpt-bidirectional-relationship.php
Created January 18, 2018 21:27
Modified version of the bidirectional relationship function to help facilitate users to cpt relationships
<?php
/*
* This code is modified from the original here
* https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-reciprocal-relationship.php
*
* Some comments may not be useful anymore since the modifications
*/
@paullacey78
paullacey78 / gp-bb.css
Last active September 23, 2018 16:51
Force GP into full width, hide page header & title and force layout to no sidebar with Beaver Builder is active on a page.
/* PAGE HEADER */
/* Hide the page header when BB is active on a page */
.hide-page-header .generate-page-header,
.hide-page-header .page-header-image,
.hide-page-header .page-header-image-single {
display:none;
}
/* Unhide the page header when BB is active but we want to use GP custom page header */
@spivurno
spivurno / gp-post-content-merge-tags-replace-merge-tags-template.php
Created July 2, 2017 13:56
Gravity Perks // GP Post Content Merge Tags // Replace Merge Tags via Code
<?php ob_start(); ?>
ALL TEMPLATE CODE GOES HERE, INSIDE THE OUTPUT BUFFER.
<?php
echo gp_post_content_merge_tags()->replace_merge_tags( ob_get_clean() );
@spivurno
spivurno / gp-notification-scheduler-cc-expiration.php
Created July 1, 2017 14:45
Gravity Perks // GP Notification Scheduler // Credit Card Expiration
<?php
/**
* Gravity Perks // GP Notification Scheduler // Credit Card Expiration
*
* Send notifications based on a credit card expiration date.
*
* @version 0.1
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/
@lukecav
lukecav / shortcode example
Created April 20, 2017 21:17
Conditional Logic in merge tags in Gravity Forms
[gravityforms action="conditional" merge_tag="{Field:1}" condition="is" value="desired value"]Show this content if the field is equal to the field value I specified earlier[/gravityforms]
@ben-heath
ben-heath / woocommerce-thankyou-sharesale.php
Created April 19, 2017 15:06
WooCommerce Thank you page - Sharesale tracking image
// This code goes in the functions.php file of you're WP theme (child theme)
add_action('woocommerce_thankyou','sls_sharesale_tracking'); // hook for the thank you page
function sls_sharesale_tracking( $order_id ) { // pass in the order id
$order = new WC_Order( $order_id );
$currency = $order->get_order_currency();
$total = $order->get_total();
$date = $order->order_date;