This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// first, get the image ID returned by ACF | |
$image_id = get_field('image_field'); | |
$image_size = 'thumbnail'; | |
$image_array = wp_get_attachment_image_src($image_id, $image_size); | |
$image_url = $image_array[0]; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// webhook: customer.subscription.deleted | |
$sec_key = 'sk_live_xxxxxxxxxxxxxxxxxx'; | |
require_once 'stripe-php/init.php'; | |
$stripe = new \Stripe\StripeClient($sec_key); | |
$last_invoice = $stripe->invoices->all(['limit' => 1]); | |
$invoice_id = $last_invoice->data[0]->id; | |
$stripe->invoices->voidInvoice($invoice_id, []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'stripe-php/init.php'; // Path to autoload.php from the Stripe SDK | |
$sec_key = 'sk_live_xxxxxxxxxxxxxxxxxxx'; | |
$limit = 999999; | |
\Stripe\Stripe::setApiKey($sec_key); | |
$stripeclient = new \Stripe\StripeClient($sec_key); | |
$cancelled_subscriptions = \Stripe\Subscription::all(['limit' => $limit, 'status' => 'incomplete_expired']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Group id shortcode | |
*/ | |
function mypmpro_groupid_shortcode() { | |
global $wpdb; | |
// Start output buffering | |
ob_start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Change Active Theme By Code | |
add_filter( 'template', 'mervin_change_theme' ); | |
add_filter( 'option_template', 'mervin_change_theme' ); | |
add_filter( 'option_stylesheet', 'mervin_change_theme' ); | |
function mervin_change_theme($theme) | |
{ | |
$theme = 'storefront'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_pmpro_save_checkout_fields($user_id) { | |
if(isset($_REQUEST['bdob'])) { | |
update_user_meta($user_id, 'pmpro_dob', $_REQUEST['bdob']); | |
} | |
} | |
add_action('pmpro_after_checkout', 'custom_pmpro_save_checkout_fields'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sec_key = 'sk_live_xxxxxxxxxxxxxxxxxxx'; | |
require_once 'stripe-php/init.php'; | |
$stripe = new \Stripe\StripeClient($sec_key); | |
$invoices = $stripe->invoices->all([ 'status' => 'uncollectible', 'limit' => 30 ]); | |
foreach ($invoices as $key => $value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$(window).on('scroll', function(){ | |
var scrollTop = $(this).scrollTop(); | |
var targetTop = $('.woocommerce-product-gallery').offset().top; | |
if (scrollTop >= targetTop) { | |
$('.woocommerce-product-gallery').addClass('highlight'); | |
} else { | |
$('.woocommerce-product-gallery').removeClass('highlight'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sp_edd_filter_query($query, $atts) | |
{ | |
// We're going to modify the order and orderby parameters depending on variables contained in the URL | |
if (isset($_GET['sp_orderby'])) { | |
$orderby = $_GET['sp_orderby']; | |
if(isset($orderby) && $orderby == 'free') { | |
// Add meta query to filter downloads with price zero | |
$meta_query = isset($query['meta_query']) ? $query['meta_query'] : array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
var unavailableDates = ["9-3-2012", "14-3-2012", "15-3-2012"]; | |
function unavailable(date) { | |
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear(); | |
if ($.inArray(dmy, unavailableDates) == -1) { | |
return [true, ""]; | |
} else { | |
return [false, "", "Unavailable"]; | |
} |
OlderNewer