Skip to content

Instantly share code, notes, and snippets.

View sc0ttkclark's full-sized avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile
@sc0ttkclark
sc0ttkclark / my-pmpro-redirect-to-referring-page-after-checkout.md
Last active June 6, 2022 12:44 — forked from ipokkel/my-pmpro-redirect-to-referring-page-after-checkout.php
Redirect new members and existing members that changes their existing level back to the referring page after checkout.

Some users reported the recipe not redirecting to the referer after checkout.

Updated the my_pmpro_redirect_to_referring_page_after_checkout_track function that sets the cookie here: ipokkel/32d6ba9425d4550a5861709498e00135

@sc0ttkclark
sc0ttkclark / wc-force-regenerate-attendees.php
Last active June 25, 2021 22:34 — forked from skyshab/example.php
This snippet will add functionality that adds a new "Regenerate Attendees" action and bulk action for WooCommerce order management -- Also available: Re-send Attendee Emails https://gist.github.com/sc0ttkclark/d534dc980c49d92c2bf915e0cce9129b
<?php
// Register the action for the Edit order screen.
add_filter( 'woocommerce_order_actions', 'tec_event_tickets_plus_wc_register_force_regenerate_attendees' );
// Register the bulk action for the Orders screen.
add_filter( 'bulk_actions-edit-shop_order', 'tec_event_tickets_plus_wc_register_force_regenerate_attendees' );
/**
* Register the custom action to the list of order actions.
@sc0ttkclark
sc0ttkclark / hide_my_pods_item_filter_post_types.php
Created April 27, 2021 18:30 — forked from kimcoleman/hide_my_pods_item_filter_post_types.php
Hide specific post types created using the Pods framework from searches and archives if membership is required to access.
<?php
/**
* Hide the 'my_pods_item' post type from searches and archives if membership is required to access.
* Update the $post_types[] array with one or more pod names you need to protect.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@sc0ttkclark
sc0ttkclark / example.php
Last active March 31, 2021 12:36 — forked from skyshab/example.php
Allow all IAC attendees to view protected content
<?php
add_filter( 'tribe_tickets_shortcode_can_see_content', static function( $can_see_content, $filter_args ) {
// Only run our logic below if the user is logged in or if they cannot currently see the content.
if ( ! is_user_logged_in() || $can_see_content ) {
return $can_see_content;
}
@sc0ttkclark
sc0ttkclark / functions.php
Last active January 27, 2021 15:10 — forked from skyshab/functions.php
Reset failed payout status for CT on Order status toggle
<?php
add_action( 'woocommerce_order_status_changed', 'rt_ct_reset_failed_payouts', 9, 4 );
function rt_ct_reset_failed_payouts( $order_id, $status_from, $status_to, $order ) {
if ( 'completed' === $status_to ) {
$payouts = tribe_payouts();
// Get payouts by Order ID.
$payouts->by( 'order', $order_id );
@sc0ttkclark
sc0ttkclark / add-product-to-cart.php
Last active March 5, 2020 08:28 — forked from kloon/gist:2376300
WooCommerce Automatically add product to cart on site visit
<?php
/*
* This code goes into theme functions.php or a custom plugin
*/
/**
* Add product to cart on page load
*/
function add_product_to_cart() {
<?php
//pods: https://imgur.com/a/MflzgtI
$search = sanitize_text_field( $search );
$query = array();
$query[] = 'brand.meta_value = ' . absint( $_REQUEST['brand_id'] );
$query[] = '
d.asset_name LIKE "%' . pods_sanitize_like( $search ) . '%"
OR product_d.sku like "%' . pods_sanitize_like( $search ) . '%"
@sc0ttkclark
sc0ttkclark / pods-persist-and-deploy.php
Created July 13, 2016 22:11 — forked from mikeschinkel/pods-persist-and-deploy.php
Deployment serialization for Pods
<?php
/**
* Plugin Name: Pods_Persist_And_Deploy
* Description: Allows locking down Pods on deployment allowing version control of Pods post types, taxonomies and fields.
*/
//
//add_action( 'plugins_loaded', array( 'Pods_Deploy', 'on_load' ), 5 );
/*
<?php
//**Most Commented On Posts Loop same as before**/
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => '1 week ago',
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
<?php
/**
* @package Pods
*/
class PodsAPI {
/**
* @var PodsAPI
*/
static $instance = null;