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
function dpcc_add_slide_out_left_navigation(){ | |
ob_start(); | |
?> | |
<div id="left-nav"> | |
<?php if ( is_user_logged_in() ) { ?> | |
<div class="dpcc-more-slide-out-left-menu"> | |
<?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?> |
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
// The Field | |
$this->cmb_resource_form->add_field( array( | |
'name' => 'Seasons', | |
'desc' => '', | |
'id' => $this->cmb_prefix . 'seasons', | |
'taxonomy' => 'season', //Enter Taxonomy Slug | |
'type' => 'taxonomy_multicheck', | |
// Optional: | |
'options' => array( | |
'no_terms_text' => 'Sorry, no seasons could be found.' // Change default text. Default: "No terms" |
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
add_action( 'pmxi_saved_post', 'sgc_post_saved', 10, 1 ); | |
function sgc_post_saved( $post_id ) { | |
// We only want to run this on import of course members | |
if ( 'course-members' === get_post_type( $post_id ) ) : | |
// Perform proper date formatting on our date of birth field, and passport dates | |
update_date_value_of_post( $post_id, 'personal_date_of_birth' ); | |
update_date_value_of_post( $post_id, 'travel_passport_date_of_issue' ); |
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 | |
$our_parsed_url = parse_url( site_url() ); | |
$link_parsed_url = parse_url( get_sub_field( 'link' ) ); | |
if ( $our_parsed_url['host'] === $link_parsed_url['host'] ) : | |
$external_link = false; | |
else : | |
$external_link = true; | |
endif; | |
?> |
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
$this->cmb_form->add_field( array( | |
'name' => 'Resource File List', | |
'desc' => '', | |
'id' => $this->cmb_prefix . 'resource_files', | |
'type' => 'file_list', | |
// 'preview_size' => array( 100, 100 ), // Default: array( 50, 50 ) | |
'attributes' => array( | |
'required' => true, // Will be required only if visible. | |
'data-conditional-id' => $this->cmb_prefix . 'resource_type', | |
'data-conditional-value' => 'files', |
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
$companies = DB::table('prices') | |
->select(DB::raw('company_id, COUNT(*) as total_products')) | |
->groupBy('company_id') | |
->orderBy('total_products', 'desc') | |
->get(); |
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
function custom_email_replace($old_replacements, $user_id){ | |
// Generate the new url we need for this user | |
$enrollment_form_url = 'special-url-'.$user_id; | |
// An array of our replacement variables and their values | |
$new_replacements = array( | |
'%enrollmentform%'=> $enrollment_form_url, | |
); | |
// Merge our two arrays together |
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
echo get_field_object( 'select_field' )['choices'][ get_field( 'select_field' ) ]; |
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
global $wpdb; | |
$sql = "SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id IN ( SELECT order_item_id FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key = '_product_id' AND meta_value = $product_id ) AND order_item_type = 'line_item'"; | |
$order_ids = $wpdb->get_col( $sql ); |
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
function custom_disable_woocommerce_billing_checkout_fields( $fields ) { | |
foreach ($fields['billing'] as $key => $billing_field){ | |
$fields['billing'][$key]['custom_attributes'] = array('disabled' => 'disabled') ; | |
} | |
return $fields; | |
} | |
add_filter( 'woocommerce_checkout_fields' , 'custom_disable_woocommerce_billing_checkout_fields' ); |