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 | |
/** | |
* Prevent wordpress from redirect deleted posts | |
*/ | |
remove_action( 'template_redirect', 'wp_old_slug_redirect' ); | |
remove_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 ); | |
add_filter( 'redirect_canonical', '__return_false' ); |
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 | |
/** | |
* Allow HTML in term (category, tag) descriptions | |
*/ | |
foreach ( array( 'pre_term_description' ) as $filter ) { | |
remove_filter( $filter, 'wp_filter_kses' ); | |
if ( ! current_user_can( 'unfiltered_html' ) ) { | |
add_filter( $filter, 'wp_filter_post_kses' ); | |
} |
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 | |
/** | |
* Change the minimum quantity to 2 | |
*/ | |
function ywp_wc_quantity_input_min_callback( $min, $product ) { | |
return 2; | |
} | |
add_filter( 'woocommerce_quantity_input_min', 'ywp_wc_quantity_input_min_callback', 10, 2 ); |
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 | |
/** | |
* Redirect to previous location after login. | |
*/ | |
function ywp_login_redirect( $redirect, $user ) { | |
return $_SERVER['HTTP_REFERER']; | |
} | |
add_filter( 'woocommerce_login_redirect', 'ywp_login_redirect', 1100, 2 ); |
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 | |
/** | |
* Change WooCommerce thank you message after successful payment | |
*/ | |
function ywp_custom_wc_thankyou_notice( $order ) { | |
return 'از خرید شما سپاسگزاریم، از لیست زیر میتوانید فایلهای خریداری شده را دانلود کنید.'; | |
} | |
add_filter( 'woocommerce_thankyou_order_received_text', 'ywp_custom_wc_thankyou_notice' ); |
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 "nofollow" to picofile external links | |
*/ | |
function ywp_nofollow_picofile_extrenal_links( $content ) { | |
$domain = "https://www.picofile.com"; | |
preg_match_all( '~<a.*>~isU', $content, $matches ); | |
for ( $i = 0; $i <= count( $matches[0] ); $i ++ ) { |
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 | |
/** | |
* Sync wc with DIGITS plugin | |
*/ | |
function ywp_sync_digits_with_wc( $customer_id, $new_customer_data, $password_generated ) { | |
$user = get_user_by( 'id', $customer_id ); | |
if ( $user && property_exists( $user, 'user_email' ) && empty( $user->user_email ) ) { | |
$fake_mail = sprintf( |
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 wpp_woodmart_ajax_search_compatibility( $args ) { | |
if ( function_exists( 'fix_arabic' ) ) { | |
$args['s'] = fix_arabic( $args['s'] ); | |
} | |
return $args; | |
} |
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 ywp_show_variation_description() { ?> | |
<div id="ywp-var-desc"></div> | |
<script> | |
jQuery(function($){ | |
$('form.variations_form').on('show_variation', function (event, data) { | |
$('#ywp-var-desc').html(data.variation_description); | |
}); | |
}) |
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 | |
/** | |
* Change min qty to area | |
*/ | |
function ywp_set_min_qty_decimal( $val ) { | |
return 0.1; | |
} | |
add_filter('woocommerce_quantity_input_min', 'ywp_set_min_qty_decimal'); |