Skip to content

Instantly share code, notes, and snippets.

View ddemuth's full-sized avatar

Dave ddemuth

View GitHub Profile
@ddemuth
ddemuth / advanced-custom-field-read-only.txt
Last active September 11, 2019 17:17
Advanced Custom Field (ACF) Read Only Field
/**
* Advanced Custom Field (ACF) Read Only Field
*
* Use prepare_field to display two fields but keep them read-only for non-admin users
*
* Check for Edit Screen: Non admin users can still add a value to inputs when adding post but
* cannot edit the input once created.
*
*/
add_action('wp_ajax_get_registrations_for_export', 'get_registrations_for_export');
add_action('wp_ajax_nopriv_get_registrations_for_export', 'get_registrations_for_export');
function get_registrations_for_export() {
// echo '<pre>';print_r($_GET);exit;
$post_statuses = array('unpaid', 'publish', 'cancelled');
$args = array(
'post_type' => 'fka_registrations',
'post_status' => $post_statuses,
@ddemuth
ddemuth / gist:02a51026c7fce7cb5b34d5eb1cef31d9
Created December 27, 2016 20:23
archive-fka_registrations
<?php get_template_part('coach/header', 'coach');?>
<?php
if ( !is_user_logged_in() ) {
auth_redirect();
}
?>
<div class="page-wrap">
<div id="content-container" class="container-fluid">
@ddemuth
ddemuth / woocommerce-custom-email-recipient.php
Last active January 30, 2021 21:42
Customize the email recipient
//WooCommerce Email Customizations
add_filter( 'woocommerce_email_recipient_customer_note', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_completed_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_invoice', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
add_filter( 'woocommerce_email_recipient_customer_processing_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2);
/**
* $recipient could be comma separated to send to additional people
* EX. $recipient .= ', $additonal_recipient';
*/
@ddemuth
ddemuth / skip-processing-on-electronic-order.php
Created June 26, 2016 17:56
AUTO COMPLETE PAID ORDERS THAT ARE PAID BY CARD OR eCHECK
/**
* AUTO COMPLETE PAID ORDERS THAT ARE PAID BY CARD OR eCHECK
*/
function fka_skip_processing_on_electronic_order( $status, $order_id ) {
// No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods.
if ( ( get_post_meta($order->id, '_payment_method', true) == 'bacs' ) || ( get_post_meta($order->id, '_payment_method', true) == 'cod' ) || ( get_post_meta($order->id, '_payment_method', true) == 'cheque' ) ) {
return;
}