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 | |
/** | |
* Hide shipping rates when free shipping is available. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
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 | |
/** | |
* Exclude specific categories from the Shop page | |
* @param $terms | |
* @param $taxonomies | |
* @param $args | |
* @return array | |
*/ | |
function ts_get_subcategory_terms($terms, $taxonomies, $args ) { | |
$new_terms = array(); |
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 | |
/** | |
* Change label for free standard shipping, when the shipping method’s rate returns $0.00 | |
* @param $full_label | |
* @param $method | |
* @return string | |
*/ | |
function custom_display_zero_shipping_cost($full_label, $method){ | |
if( $method->cost == 0.0 ) { | |
$full_label = '<span class=”woocommerce-Price-amount amount”>Free Shipping</span>'; |
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 | |
/** | |
* Redirect user to different page based on userrole after password reset from backend screen | |
* @param $user | |
*/ | |
function custom_redirect_retail_page_based_on_role($user) { | |
$user_roles = (array) $user->roles; | |
if ( in_array('userrole1', $user_roles) ) { | |
wp_redirect( 'Custom Page Link' ); |
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 | |
function add_custom_filters_and_actions() { | |
add_filter( 'woocommerce_webhook_topic_hooks', 'add_custom_wcs_topics', 30, 2 ); | |
add_filter( 'woocommerce_valid_webhook_events', 'add_custom_wcs_events', 20, 1 ); | |
add_filter( 'woocommerce_webhook_topics' , 'add_custom_wcs_topics_admin_menu', 20, 1 ); | |
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_registration_redirect() { | |
wp_logout(); | |
return home_url('/'); | |
} | |
add_action('woocommerce_registration_redirect', 'custom_registration_redirect', 2); |
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('wp_logout','auto_redirect_after_logout'); | |
function auto_redirect_after_logout(){ | |
wp_redirect( home_url() ); | |
exit(); | |
} |
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
document.write("<?php the_time('F jS, Y') ?>"); |
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 | |
/** | |
* How to disable taxonomy archives in WordPress? | |
* @author Dhiren Patel | |
* @link http://www.dhirenpatel.me/ | |
*/ | |
// Register Custom Taxonomy | |
function custom_taxonomy() { | |
$labels = array( |
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 | |
function add_custom_filters_and_actions() { | |
add_filter( 'woocommerce_webhook_topic_hooks', 'add_custom_wcs_topics', 30, 2 ); | |
add_filter( 'woocommerce_valid_webhook_events', 'add_custom_wcs_events', 20, 1 ); | |
add_filter( 'woocommerce_webhook_topics' , 'add_custom_wcs_topics_admin_menu', 20, 1 ); | |
NewerOlder