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 | |
/** | |
* GravityForm default user's merge tags doc: https://docs.gravityforms.com/user-merge-tag/ | |
* Sometimes, default merge tags are not enough for us. | |
* With this snippet you can add custom user meta as a | |
* new merge tag to gform. | |
*/ | |
/** |
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_product_stock_status_options', 'ywp_custom_product_stock_status' ); | |
function ywp_custom_product_stock_status( $status ) { | |
$status['my_first_status'] = 'وضعیت جدید اول'; | |
$status['my_second_status'] = 'وضعیت جدید دوم'; | |
return $status; |
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_action( 'wp_footer', 'ywp_goftino_auto_pm' ); | |
function ywp_goftino_auto_pm() { | |
echo '<script> | |
if (!localStorage.getItem("goftino_timing") || new Date().getTime() - localStorage.getItem("goftino_timing") >= 60000*24*60){ | |
localStorage.setItem("goftino_timing", new Date().getTime()); | |
localStorage.removeItem("goftino_autopm"); | |
} | |
</script>'; | |
} |
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_product_add_to_cart_text', 'ywp_custom_product_add_to_cart_text', 10, 2 ); | |
// تغییر متن دکمه در صفحه محصول | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'ywp_custom_product_add_to_cart_text', 10, 2 ); | |
function ywp_custom_product_add_to_cart_text( $add_to_cart_text, $product ) { | |
if( $product->is_in_stock() && $product->is_downloadable() && $product->get_price() == 0 ) { // محصول موجود، دانلودی و قیمتش صفر باشه |
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 | |
/** | |
کد زیر رو به فایل | |
functions.php | |
قالبتون اضافه کنید: | |
**/ | |
/** | |
* Add calculator Shortcode | |
*/ |
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
# For posts categories | |
SELECT t.term_id AS id, | |
t.name AS 'Term Title', | |
t.slug AS 'Slug' | |
FROM wp_terms t | |
LEFT JOIN wp_term_taxonomy tt | |
ON t.term_id = tt.term_id | |
WHERE tt.taxonomy = 'category' | |
ORDER BY name; |
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 | |
/** | |
* Hook on auth_cookie_expiration | |
* The code goes in your theme/child theme functions.php | |
* You can also use this plugin: https://wordpress.org/plugins/code-snippets/ | |
*/ | |
add_filter ( 'auth_cookie_expiration', 'ywp_change_remember_me' ); | |
function ywp_change_remember_me( $expire ) { | |
return YEAR_IN_SECONDS; |
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 | |
/** | |
* Show weight and dementions end of additional information | |
*/ | |
remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 ); | |
add_action( 'woocommerce_product_additional_information', 'ywp_display_product_attributes', 10 ); | |
function ywp_display_product_attributes( $product ) { | |
$product_attributes = array(); |
OlderNewer