/
home
/
seoirandns
/
public_html
/
Upload File
HOME
<?php /** * * The framework's functions and definitions */ define( 'WOODMART_THEME_DIR', get_template_directory_uri() ); define( 'WOODMART_THEMEROOT', get_template_directory() ); define( 'WOODMART_IMAGES', WOODMART_THEME_DIR . '/images' ); define( 'WOODMART_SCRIPTS', WOODMART_THEME_DIR . '/js' ); define( 'WOODMART_STYLES', WOODMART_THEME_DIR . '/css' ); define( 'WOODMART_FRAMEWORK', '/inc' ); define( 'WOODMART_DUMMY', WOODMART_THEME_DIR . '/inc/dummy-content' ); define( 'WOODMART_CLASSES', WOODMART_THEMEROOT . '/inc/classes' ); define( 'WOODMART_CONFIGS', WOODMART_THEMEROOT . '/inc/configs' ); define( 'WOODMART_HEADER_BUILDER', WOODMART_THEME_DIR . '/inc/modules/header-builder' ); define( 'WOODMART_ASSETS', WOODMART_THEME_DIR . '/inc/admin/assets' ); define( 'WOODMART_ASSETS_IMAGES', WOODMART_ASSETS . '/images' ); define( 'WOODMART_API_URL', 'https://xtemos.com/wp-json/xts/v1/' ); define( 'WOODMART_DEMO_URL', 'https://woodmart.xtemos.com/' ); define( 'WOODMART_PLUGINS_URL', WOODMART_DEMO_URL . 'plugins/' ); define( 'WOODMART_DUMMY_URL', WOODMART_DEMO_URL . 'dummy-content-new/' ); define( 'WOODMART_TOOLTIP_URL', WOODMART_DEMO_URL . 'theme-settings-tooltips/' ); define( 'WOODMART_SLUG', 'woodmart' ); define( 'WOODMART_CORE_VERSION', '1.1.8' ); if ( ! function_exists( 'woodmart_load_classes' ) ) { /** * Load theme PHP classes. * * @return void */ function woodmart_load_classes() { $classes = array( 'class-singleton.php', 'class-api.php', 'class-config.php', 'class-layout.php', 'class-autoupdates.php', 'class-activation.php', 'class-notices.php', 'class-theme.php', 'class-registry.php', ); foreach ( $classes as $class ) { require WOODMART_CLASSES . DIRECTORY_SEPARATOR . $class; } } } woodmart_load_classes(); new XTS\Theme(); define( 'WOODMART_VERSION', woodmart_get_theme_info( 'Version' ) ); add_action('wp_footer', function(){ ?> <script> jQuery(function($){ $('.elementor-heading-title').each(function(){ let t=$(this).text().trim(); t=t.replace(/Responses/g,' دیدگاه >'); t=t.replace(/Response/g,' < دیدگاه '); $(this).text(t); }); }); </script> <?php }); add_shortcode('custom_product_attributes', function(){ if ( ! is_product() ) { return ''; } return '<div class="custom-product-attributes"></div>'; }); // 1) حذف فرم پیشفرض ووکامرس (variations + add to cart) remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); // 2) شورتکد نمایش فقط ویژگیها (variations) add_shortcode( 'product_variations', function() { global $product; if ( ! $product || ! $product->is_type( 'variable' ) ) return ''; ob_start(); ?> <div class="custom-variations-wrapper"> <?php woocommerce_template_single_add_to_cart(); ?> </div> <style> .custom-variations-wrapper .single_add_to_cart_button, .custom-variations-wrapper .quantity, .custom-variations-wrapper .woocommerce-variation-add-to-cart { display: none !important; } </style> <?php return ob_get_clean(); }); // 3) شورتکد نمایش فقط دکمه افزودن به سبد خرید add_shortcode( 'product_add_to_cart_btn', function() { global $product; if ( ! $product ) return ''; ob_start(); woocommerce_template_single_add_to_cart(); return ob_get_clean(); }); add_shortcode('product_attributes_box', function(){ global $product; if(!$product){ return ''; } $attributes = $product->get_attributes(); if(empty($attributes)){ return ''; } ob_start(); echo '<div class="product-attributes-box">'; foreach($attributes as $attribute){ if(!$attribute->get_visible()){ continue; } $name = wc_attribute_label($attribute->get_name()); if($attribute->is_taxonomy()){ $values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array('fields'=>'names') ); $value = implode('، ', $values); }else{ $value = implode('، ', $attribute->get_options()); } echo ' <div class="attribute-card"> <div class="attribute-title">'.$name.'</div> <div class="attribute-value">'.$value.'</div> </div>'; } echo '</div>'; return ob_get_clean(); });