This file contains 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 | |
add_filter( 'product_type_selector', 'remove_product_types' ); | |
function remove_product_types( $types ){ | |
unset( $types['grouped'] ); | |
unset( $types['external'] ); | |
return $types; | |
} |
This file contains 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 | |
add_shortcode('prefix_shortcode', 'prefix_shortcode'); | |
function prefix_shortcode() { | |
ob_start(); | |
?> | |
//your html | |
<?php | |
$output_string = ob_get_contents(); |
This file contains 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 | |
//處理訂單狀態 | |
add_filter( 'handle_bulk_actions-edit-shop_order', 'wootest_handle_bulk_actions_edit_product', 10, 3 ); | |
function wootest_handle_bulk_actions_edit_product( $redirect_to, $action, $post_ids ) { | |
global $typenow; | |
$post_type = $typenow; | |
if( $post_type == 'shop_order' ) { | |
$wp_list_table = _get_list_table('WP_Posts_List_Table'); |
This file contains 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 | |
function register_awaiting_shipment_order_status() { | |
register_post_status( 'wc-awaiting-shipment', array( | |
'label' => '等待運送', | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, | |
'show_in_admin_status_list' => true, | |
'label_count' => _n_noop( '等待運送 <span class="count">(%s)</span>', '等待運送 <span class="count">(%s)</span>' ) | |
) ); |
This file contains 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 | |
add_filter( 'woocommerce_new_customer_data', 'my_new_customer_data'); | |
function my_new_customer_data($new_customer_data){ | |
$new_customer_data['role'] = get_option( 'default_role' ); | |
//$new_customer_data['role'] = 'vip'; | |
return $new_customer_data; | |
} |
This file contains 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 | |
$orders = get_posts( array( | |
'post_type' => 'shop_order', | |
'post_status' => array('wc-packing') | |
)); | |
This file contains 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 | |
function themeslug_customize_register( $wp_customize ) { | |
// Do stuff with $wp_customize, the WP_Customize_Manager object. | |
} | |
add_action( 'customize_register', 'themeslug_customize_register' ); | |
This file contains 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 | |
remove_filter( 'the_title', 'capital_P_dangit', 11 ); | |
remove_filter( 'the_content', 'capital_P_dangit', 11 ); | |
remove_filter( 'comment_text', 'capital_P_dangit', 31 ); | |
This file contains 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 | |
//remove the following code after membership is added | |
add_action( 'init', 'myprefix_add_membership'); | |
function myprefix_add_membership() { | |
$customers = get_users('role=customer'); | |
$plan_id = 21356;//一般會員 | |
foreach( $customers as $customer ): | |
$normal_membership = wc_memberships_get_user_membership( $customer->id, 'normal'); | |
if ($normal_membership) { | |
continue; |