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 woocommerce_template_loop_product_thumbnail() { | |
echo woocommerce_get_product_thumbnail( 'full' ); | |
} |
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
if ( current_user_can( 'manage_options' ) ) { | |
var_dump( get_product_vendors( $product->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
function wcsdp_get_available_payment_gateways( $available_gateways ) { | |
global $wp; | |
if ( class_exists( 'WC_Subscriptions_Cart' ) ) { | |
if ( WC_Subscriptions_Cart::cart_contains_subscription() || WC_Subscriptions_Cart::cart_contains_subscription_renewal() || ( is_checkout_pay_page() && WC_Subscriptions_Order::order_contains_subscription( $wp->query_vars['order-pay'] ) ) ) { | |
if ( isset( $available_gateways['paypal'] ) ) { | |
unset( $available_gateways['paypal'] ); | |
} | |
// just repeat the same thing for the next payment gateway |
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_filter('sensei_single_title', 'custom_single_title_prepend'); | |
/** | |
* Filter the sensei single titles ( singular course, lesson and quiz ) | |
* | |
* @param $title | |
* @return string | |
*/ | |
function custom_single_title_prepend( $title ){ |
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_filter( 'wcopc_products_query_args', 'wc_opc_custom_query_args' ); | |
function wc_opc_custom_query_args( $args ) { | |
if ( isset( $args['meta_query'][0]['value'] ) ) { | |
array_push( $args['meta_query'][0]['value'], 'hidden' ); | |
} | |
return $args; | |
} |
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 fields to new vendor form | |
add_action( 'shop_vendor_add_form_fields', 'custom_add_vendor_fields', 2, 1 ); | |
function custom_add_vendor_fields( $taxonomy ) { | |
?> | |
<div class="form-field"> | |
<label for="vendor_website"><?php _e( 'Vendor website' ); ?></label> | |
<input type="text" name="vendor_data[website]" id="vendor_website" class="vendor_fields" /><br/> | |
<span class="description"><?php _e( 'The vendor\'s website.' ); ?></span> | |
</div> | |
<?php |
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
/** | |
* Check the cart for specific classes, remove UPS Shipping method if they are present | |
* | |
* REMOVE THE TOP <?php if there is no ?> before (or you have an error after adding this) | |
* | |
* Add the code to your theme functions.php file | |
*/ | |
add_filter( 'woocommerce_package_rates', 'unset_ups_shipping_method' , 10, 2 ); | |
function unset_ups_shipping_method( $rates, $package ) { | |
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_filter('sensei_check_for_activity', 'sensei_allow_teachers_to_grade_all_quizzes', 5 ); | |
function sensei_allow_teachers_to_grade_all_quizzes( $args ){ | |
// remove the limit | |
remove_filter( 'sensei_check_for_activity' , array( Sensei()->teacher, 'filter_grading_activity_queries') ); | |
// make sure to the return the expected arguments | |
return $args; |
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
/** | |
* Get the list of users who have completed a specific course: | |
*/ | |
// Course ID can be found in the URL when you edit the course | |
$course_id = '2607'; | |
$activity_args = array( | |
'post_id' => $course_id, | |
'type' => 'sensei_course_status', |
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_filter( 'woocommerce_prevent_admin_access', 'wc_custom_dashboard_access' ); | |
function wc_custom_dashboard_access( $default ) { | |
if ( current_user_can( 'custom_retailer_capability' ) ) { | |
$default = false; | |
} | |
return $default; | |
} |