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
$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
<?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
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
// 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
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
<?php | |
$questions_wanted = 2000; | |
$questions_got = 0; | |
$all_questions = []; | |
while($questions_got < $questions_wanted){ | |
$questions = Sensei()->lesson->lesson_quiz_questions( get_the_ID() ); | |
if( count( $questions ) > 0 ){ | |
foreach($questions as $question): | |
array_push($all_questions, $question->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
public function prepare() { | |
$data = []; | |
$total = 0; | |
// Get the regions | |
$regions = get_terms( array( | |
'taxonomy' => 'naspd_company_region', | |
'hide_empty' => true, | |
) ); | |
foreach ( $regions as $region ) { |
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 | |
/** | |
* Functionality for managing WP Super Cache | |
*/ | |
/** | |
* On post save | |
* |
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 | |
/* | |
* This would fit into yourtheme/woocommerce/emails/email-order-details.php and replace the existing loop of totals in there. | |
*/ | |
if ( $totals = $order->get_order_item_totals() ) { | |
$i = 0; | |
foreach ( $totals as $key => $total ) { | |
$i++; |