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 | |
/** | |
* Register custom Elementor display conditions. | |
* | |
* @param \Elementor\Core\Kits\Documents\Tabs\Conditions_Manager $conditions_manager | |
* @return void | |
*/ | |
function register_custom_elementor_conditions( $conditions_manager ) { |
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 set_elementor_global_colors_once() { | |
if ( ! get_option('my_theme_elementor_colors_set') ) { | |
$global_settings = \Elementor\Plugin::$instance->kits_manager->get_active_kit(); | |
$global_settings->set_settings([ | |
'system_colors' => [ | |
'primary-color' => [ | |
'title' => __('Primary Color', 'your-textdomain'), | |
'color' => '#1e73be', |
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 | |
use Elementor\Core\DynamicTags\Tag; | |
class Custom_Meta_Fields_Tag extends \Elementor\Core\DynamicTags\Tag { | |
public function get_name() { | |
return 'custom-meta-fields'; | |
} |
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 | |
// document | |
https://developers.elementor.com/docs/controls/ | |
// Define | |
use Elementor\Base_Data_Control; | |
class My_Select2_Control extends Base_Data_Control { | |
public function get_type() { |
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_filter( 'elementor/dynamic_tags/tag_value', function( $value, $tag ) { | |
// بررسی اینکه آیا تگ مورد نظر "custom field" هست | |
if ( $tag->get_name() === 'post-custom-field' ) { | |
// گرفتن post ID فعلی | |
$post_id = get_the_ID(); |
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 | |
// 1. Modify the generated permalink | |
function custom_post_type_permalink($post_link, $post) { | |
if ('download' == $post->post_type) { | |
$post_link = home_url( | |
user_trailingslashit("downloads/{$post->ID}/{$post->post_name}") | |
); | |
} |
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 Session Auth Cookie | |
add_filter('auth_cookie_expiration', 'filter_auth_cookie_expiration', 99, 3); | |
function filter_auth_cookie_expiration($seconds, $user_id, $remember){ | |
$user = get_userdata($user_id); | |
if ( in_array( 'customer', (array) $user->roles ) || in_array( 'subscriber', (array) $user->roles ) ) { | |
return $seconds; | |
} |
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 | |
// Setup CronJob | |
//add_action('plugins_loaded', 'add_custom_wc_cron_job_note_completed', 70); | |
function add_custom_wc_cron_job_note_completed() | |
{ | |
if (!wp_next_scheduled('delete_order_notes_completed')) { | |
wp_schedule_event(time(), 'daily', 'delete_order_notes_completed'); | |
} | |
} |
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 | |
// Remove Image Classes | |
// using function to add class to `the_post_thumbnail()` | |
// https://wordpress.stackexchange.com/questions/102158/add-class-name-to-post-thumbnail | |
add_filter('wp_get_attachment_image_attributes','filter_the_post_thumbnail_remove_class'); | |
function filter_the_post_thumbnail_remove_class($attr) { | |
if(is_admin() || wp_doing_ajax()) { | |
return $attr; |
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 | |
// https://github.com/woocommerce/woocommerce/issues/27673 | |
add_action('plugins_loaded', function(){ | |
remove_action( 'woocommerce_order_status_pending', 'wc_update_coupon_usage_counts'); | |
}); | |
//add_filter( 'woocommerce_hold_stock_for_checkout', function() { return false; } ); | |
function woo_set_coupon_hold_minutes( $mins ) { |