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_gforms_strip_meta_html', 'configure_woocommerce_gforms_strip_meta_html' ); | |
function configure_woocommerce_gforms_strip_meta_html( $strip_html ) { | |
$strip_html = false; | |
return $strip_html; | |
} |
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 wc_loop_stock_show( $atts, $content = null ) { | |
extract( shortcode_atts( array( 'product' => '' ) ), $atts ); | |
echo '<p class="total-sales">Sold: ' . absint( get_post_meta( $product, 'total_sales', true ) ) . '</p>'; | |
} | |
add_shortcode( 'sold', 'wc_loop_stock_show' ); |
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
// register the action filter | |
add_filter('sensei_user_quiz_status', 'custom_sensei_quiz_status', 20 , 3 ); | |
/** | |
* Custom function that hooks into sensei_user_quiz_status | |
* | |
* @param array $status_data{ | |
* type string $status | |
* type string $box_class | |
* type string $message |
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( 'sensei_learners_extra', 'custom_sense_disable_teacher_learner_add', 1 ); | |
function custom_sense_disable_teacher_learner_add ( ){ | |
// remove the learner add box for teachers | |
if( ! current_user_can( 'manage_options' ) ){ | |
remove_all_actions( 'sensei_learners_extra' ); | |
} |
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
.form-row.woocommerce-invalid .chzn-single, | |
.form-row.woocommerce-invalid .chzn-drop, | |
.form-row.woocommerce-invalid input.input-text, | |
.form-row.woocommerce-invalid select { | |
border:1px solid red; | |
} | |
.form-row.woocommerce-validated .chzn-single, | |
.form-row.woocommerce-validated .chzn-drop, | |
.form-row.woocommerce-validated input.input-text, | |
.form-row.woocommerce-validated select { |
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
.form-row.woocommerce-invalid .chzn-single, | |
.form-row.woocommerce-invalid .chzn-drop, | |
.form-row.woocommerce-invalid input.input-text, | |
.form-row.woocommerce-invalid select { | |
border:1px solid red; | |
} | |
.form-row.woocommerce-validated .chzn-single, | |
.form-row.woocommerce-validated .chzn-drop, | |
.form-row.woocommerce-validated input.input-text, | |
.form-row.woocommerce-validated select { |
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( 'wc_order_is_editable', 'wc_make_processing_orders_editable', 10, 2 ); | |
function wc_make_processing_orders_editable( $is_editable, $order ) { | |
if ( $order->get_status() == 'processing' ) { | |
$is_editable = true; | |
} | |
return $is_editable; | |
} |
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( 'wc_order_is_editable', 'wc_make_processing_orders_editable' ); | |
function wc_make_processing_orders_editable( $statuses ) { | |
if ( ! in_array( 'processing', $statuses ) ) { | |
array_push( $statuses, 'processing' ); | |
} | |
return $statuses; | |
} |
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 wc_allow_subscriber_admin_access( $prevent ) { | |
$user = get_userdata( get_current_user_id() ); | |
$role = $user->roles[0]; | |
if ( $role == 'subscriber' ) { | |
return false; | |
} | |
return $prevent; | |
} |
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 the field to order emails | |
**/ | |
add_filter('woocommerce_email_order_meta_keys', 'my_custom_checkout_field_order_meta_keys'); | |
function my_custom_checkout_field_order_meta_keys( $keys ) { | |
$keys[‘My Field 1′] = ‘_my_field_1; | |
$keys[‘My Field 2′] = ‘_my_field_2′; | |
return $keys; | |
} |