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 | |
/** | |
* @param $query | |
* @param $product_id | |
* @param $exclude_order_id | |
* | |
* @return mixed|string | |
*/ |
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 Default Comment Login link to UM Login Page | |
*/ | |
if ( ! function_exists( 'ywp_um_change_login_link' ) ) { | |
function ywp_um_change_login_link( $defaults ) { | |
if ( class_exists( 'UM' ) ) { | |
$defaults['must_log_in'] = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), um_get_core_page( 'login' ) ) . '</p>'; | |
return $defaults; |
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 | |
defined( 'ABSPATH' ) || exit; | |
/** | |
* | |
*/ | |
class YWP_Walker_CategoryDropdown extends Walker { | |
/** | |
* What the class handles. |
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 | |
/** | |
* @param $columns | |
* | |
* @return mixed | |
*/ | |
function ywp_add_billing_phone_column_in_review_list( $columns ): mixed { | |
$columns['billing_phone'] = __( 'Billing Phone' ); |
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 | |
/** | |
* 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 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 | |
/** | |
* 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 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 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 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 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 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 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 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 | |
/** | |
* 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 ++ ) { |