<?php 



add_filter('woocommerce_register_post_type_product', 'remove_shop_default_description');
function remove_shop_default_description($args){
$args['description'] = '';
 	return $args;
}
 // new style for farnam //
 function mt_new_css() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'mt_new_css', $base.'/mt.css' );
 }
 add_action('wp_enqueue_scripts', 'mt_new_css', 2 );
  function flat_new_css() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'flat_new_css', $base.'/uicons-regular-rounded.css' );
 }
 add_action('wp_enqueue_scripts', 'flat_new_css', 4 );
 
 function owl_new_css() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'owl_new_css', $base.'/owl/owl.carousel.min.css' );
 }
 add_action('wp_enqueue_scripts', 'owl_new_css', 98 );
    function owl_new_cssswit() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'owl_new_cssswit', $base.'/owl/swit.css' );
 }
 add_action('wp_enqueue_scripts', 'owl_new_cssswit', 99 );
 
 function style_new_css() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'style_new_css', $base.'/style.css' );
 }
 add_action('wp_enqueue_scripts', 'style_new_css', 98 );
  function style_n77ew_css() {
      $base = get_stylesheet_directory_uri();
	  	        wp_enqueue_style( 'style_n77ew_css', $base.'/fmfont.css' );
 }
 add_action('wp_enqueue_scripts', 'style_n77ew_css', 98 );
 
 // new js for vendad //

			function add_theme_scripts2() {  
  wp_enqueue_script( 'script1', get_template_directory_uri() . '/owl/jquery.min.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts2' , 2 );


			function add_theme_owl() {  
  wp_enqueue_script( 'owl', get_template_directory_uri() . '/owl/owl.carousel.min.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_owl' , 2 );

			function add_theme_owlswit() {  
  wp_enqueue_script( 'owlswit', get_template_directory_uri() . '/owl/swit.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_owlswit' , 3 );



			function add_theme_owl9() {  
  wp_enqueue_script( 'owl9', get_template_directory_uri() . '/owl/jquery.countdown.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_owl9' , 3 );



			function add_theme_owl99() {  
  wp_enqueue_script( 'owl99', get_template_directory_uri() . '/owl/jquery.countdown.min.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_owl99' , 4 );




			function add_theme_owl999() {  
  wp_enqueue_script( 'owl999', get_template_directory_uri() . '/owl/jstheme.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_footer', 'add_theme_owl999' , 18 );
			function add_theme_owl999999() {  
  wp_enqueue_script( 'owl999999', get_template_directory_uri() . '/owl/main.js', array ( 'jquery' ), true);
 
  
}


add_action( 'wp_footer', 'add_theme_owl999999' , 19 );


			function add_theme_globaljs() {  
  wp_enqueue_script( 'globaljs', get_template_directory_uri() . '/owl/global.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_globaljs' , 4 );
  

			function add_theme_globaljsrange() {  
  wp_enqueue_script( 'globaljsrange', get_template_directory_uri() . '/owl/jquery-ui.js', array ( 'jquery' ), true);
 
  
}
add_action( 'wp_enqueue_scripts', 'add_theme_globaljsrange' , 5 );

function enqueue_slider_scripts() {

    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-slider');

    // کتابخانه Touch Punch
    wp_enqueue_script(
        'jquery-ui-touch-punch',
        get_template_directory_uri() . '/owl/jquery.ui.touch-punch.min.js',
        array('jquery', 'jquery-ui-slider'),
        '0.2.3',
        true
    );
}
add_action('wp_enqueue_scripts', 'enqueue_slider_scripts');


function myscript() {
?>



<script>


var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    /* Toggle between adding and removing the "active" class,
    to highlight the button that controls the panel */
    this.classList.toggle("active");

    /* Toggle between hiding and showing the active panel */
    var panel = this.nextElementSibling;
    if (panel.style.display === "block") {
      panel.style.display = "none";
    } else {
      panel.style.display = "block";
    }
  });
} 
<?php echo get_option('jscode'); ?>
</script>

     <script type="text/javascript">   $('document').ready(function () {   $(".mik983343242").click(function(){    $('.user-meta').slideToggle('slow');   });   });
</script>

<style>

<?php echo get_option('csscode'); ?>


</style>
<?php
}
add_action( 'wp_footer', 'myscript' );
////// ADD FAVICON //////
function my_favicon() { ?>
<link href="<?php echo get_option('logolinkfa'); ?>" rel="shortcut icon">
<style>

.pageone1 .woocommerce-Address h2::before , #filterasli .close-btn-mehr-filter , .factor-page-iran-order , .mehrnoosh-h3-order-view i::after  , .ui-slider .ui-slider-range , .mehrnoosh-price-filter-bottom , .product-list-order-view-count , .etel-title-order::before , .closebtnw , .fieldbox-top-456456666666666v .woocommerce-customer-details h2::before , .fieldbox-top-456456666666666v .woocommerce-order-details h2::before , .postnumber-no-farnam .copy-button , .order-single-farnam0-21 .woocommerce-column__title::before , .order-single-farnam0-21 .woocommerce-order-details__title::before  , .woocommerce-orders-table.woocommerce-MyAccount-orders.shop_table.shop_table_responsive.my_account_orders.account-orders-table .woocommerce-button.button , .header-one-tab-order .orderactive-header-farnam.order-header-farnam , .lidemt , .mike-single-box-imgee .mdi.mdi-comment-question-outline , .mik-woo-delhah-title::before , .owl-pone-delkhah.owl-carousel.owl-rtl.owl-loaded.owl-drag .owl-dots button.owl-dot.active , #single-product-tab-402-1 ul li.active a , #related-single-product-6542s h4::before , #single-product-tab-402-1 .woocommerce-Tabs-panel h2:first-child::after , #tab-seller_enquiry_form h3::after , .Property-sepid.single-product-402-1-sepid h4::before , #videob17 , .dokanvendore .percentage , .woocommerce-product-gallerynewimagebox12 .mizan-flash5555 , .zemanat-single-product55ffff , .woof_price_search_container.woof_container.woof_price_filter form::after , .ht-row.ns-402-197564876-000 .owl-nav button:hover , .mifgdfg-34534 .button.add_to_cart_button.added , .meta-catalog-date-box.ert45t55 , .slide401 .swiper-pagination-bullet-active  , .box-simage-havine-2 i , .cat-blog-post-401 , .mizan12rre , .product-style.htpp.ir-owl.new-offer-401::before , .min-icon-footer:hover .fi.fi-rr-home , .min-icon-footer .sabadnumbercolor , .modal-etel111 .elktwo::before , .modal-etel111 .khorooj-sistem , .modaldakhel , .closeiran-s , #videom .close , #sharem .close1 , .sgare-sepid-box span::before , .chap-12221 , .share-video-moarefi:hover  , .woocommerce-MyAccount-navigation-link.is-active a::after , .title-2.sef754343 a , .user-bar-401-link:hover , .khotooj-az-site , .noosh-19::before , .div-bars-checkout-1400::before , .noosh-201::before , .div-bars-checkout-1400.ggtt-1400::after , .noosh-21::after  , .noosh-201::after , .noosh-201::after , .box-vat-z12 h3::before , .mik-999-1400 .page-numbers.current , .barsf , .noosh-19::after , .ht-row.roozaye-barfi.iran-gaj-listmahsool.panjere-99-001-1400 h5 .spand4433::before  , .lahze-offer.lahze-offer-two ins , .ht-row.offer-8-gaj ins
 , .gajslider .swiper-pagination-bullet-active , .lahze-offer.lahze-offer-two h2::before , .product-style.htpp.ir-owl.offer-00-1::before  , .progress-bar-bamdad , .menu-header .dmega .sub-menu .sub-menu li a::before , .mizany , .gffhrttrh-5445tgg h3::after , .mehr-65-tedad , .loader-bar , .iran-farnam-9-box-iner , .iran-farnam-9-box-iner::before , .iran-farnam-9-box-iner::after , .sssbox.newsearch.yad-2020-1 .submit.icon-search , .owl-koffer .owl-dots button.active , .darsad-new-mank , .side-meta-1-box:hover  ,.darsad , .left-rr-user , .commentlist::after  , .left-sabad span , .woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li span.current
, .mizan , .mizan-6 , .price-kharid .single_add_to_cart_button.button.alt , .vijegi h4::before , .woocommerce div.product .woocommerce-tabs ul.tabs li.active , .woocommerce-Tabs-panel h2::before
, .risk-meta span:hover , .woocommerce #review_form #respond .form-submit input , .mob-1 .submit.icon-search , .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button
, .woocommerce #reviews #comments ol.commentlist li img.avatar  , .head-page , .woocommerce .cart .button, .woocommerce .cart input.button , .footer-menu-box h3::before , .woocommerce-MyAccount-navigation-link.is-active a
, .in1 img , .mini-1-time , .elkone h3::before , .onvanij::before , .menu-header ul .mega .sub-menu li a::before , .matn-didgah h3::before , .category-111 , .styleslider .swiper-pagination-bullet-active 
, .post-n-meta.meta-tag-1 a , .main-blog-1345435 #submit , .main-blog-1345435 .comment-reply-link , .product-list234234 h3::after , .blog-widget h4::after , .main-blog-1 .page-numbers.current , .box-etel h3::before
, .side-meta-1-box.ghgfhtr .woosc p-btn-added , .cpmare-wefew .woosc p-btn-added , .pf-help-title h4::before , .risk-meta.hoversho-www1 .cpmare-wefew .woosc p-btn-added , #thumbs .current .item-thumbin img 
, .wpcf7-form-control.wpcf7-submit , .footerh3 h3::before , .checkoutnew-1 #order_review_heading::before , .checkoutnew-1 .woocommerce-billing-fields h3::before , .dokan-account-migration-lists .dokan-w4.right-content a , .cart_totals h2::before ,.mini-cart-3 .remove.remove_from_cart_button , .irs-from, .irs-to, .irs-single , .woof_container h4::before , .wpfFilterTitle::before , .wpfFilterButton.wpfButton , .ui-slider.ui-widget-content .ui-slider-handle 
{
background: <?php echo get_option('color1'); ?>;	
}

.elementor-485 .elementor-element.elementor-element-2036866 a.elementor-button, .elementor-485 .elementor-element.elementor-element-2036866 .elementor-button {
	background-color: <?php echo get_option('color1'); ?>;	
}
#single-product-tab-402-1 #tab-description ul li strong , #single-product-tab-402-1 #tab-description ul li::before , .form-row.form-row-firstertertert .button:hover , .postlinkdddd , .userj88u #reg-btn , .orderactive-header-farnam.order-header-farnam .dayere-header-order-farnam , .meta-v-sopid-box #tazminesalaat-sin:hover i , .meta-v-sopid-box .woosc-btn:hover , .tedad-sepid-single , .meta-v-sopid-boxre5ty45y45 #shareb:hover i , .mizan-flash5555eee , .Property-sepid.single-product-402-1-sepid ul li strong , .nimche-21 .woosc-btn-added.woosc-added , .risk-meta.hoversho-www1.ffgt544 .woosc-btn-added.woosc-added , .ittyn2 .khorooj-sistem , .l9ink-vorood-sho:hover , .price-new34534543 ins , .onvan-claasd43 strong , .min-icon-footer:hover , .bamdad-darsad , .dmega .sub-menu li:hover a , .farnam-offer-slider-1 .pricr-offer ins , .darsad-7 , .lahze-offer .product-list-1.ps3.jjj-112 .darsad , .chakame-123-d , .outofstock-new-2 , .ps3 ins , .side-1-product-box i  , .user-meta a:hover , .header-one-1 span i , .menu-header .current-menu-item a , .mega .sub-menu li .sub-menu li:hover a 
, .price-kharid .price ins , .vijegi strong , #reg-btn , .pricr-offer ,.pricr-offer ins , .share-2 a:hover , .left-timer-123123 h3 , .share-iran-32 a:hover , .price-kharid4543543 ins
, .dakhel-offer-12 , .price-kharid4543543 , .risk-meta.hoversho-www1 .cpmare-wefew-1 .woosq-btn:hover , .risk-meta.hoversho-www1 .cpmare-wefew .woosc p-btn:hover , .dokan-single-store .dokan-store-tabs ul li a:hover {
color: <?php echo get_option('color1'); ?>;	
}
.show-ticket-mbn , .axtion-farnam-list .woocommerce-button , .offer-new-401-box .mini-1-time , .dmega .sub-menu .sub-menu li .sub-menu li:hover a , .dakhel-offer-12 , .product-style.htpp.ir-owl.offer-00-1.slide-new-4-slide .time1.mini-1-time {
color: <?php echo get_option('color1'); ?> !important;	
}

.woocommerce-variation-radio input[type="radio"]:checked + label , .product-categories-filter.mehrnoosh-category-list-in-shop .current-category::before , .ui-slider span , .woocommerce-orders-table.woocommerce-MyAccount-orders.shop_table.shop_table_responsive.my_account_orders.account-orders-table .woocommerce-button.button , .circle98 , .menu-item-has-children:hover ,  .product-style.htpp.ir-owl.offer-00-1 , #thumbs .current .item-thumbin , .menu-item-has-children:hover {
	border-color: <?php echo get_option('color1'); ?>;	
}

.owl-dot.active::before , .mizan-flash5555  {
	border-right-color: <?php echo get_option('color1'); ?>;
	
}

.farnam-offer-slider-1 .owl-dot.active::before , .lahze-offer.lahze-offer-two ins::before , .ht-row.offer-8-gaj ins::before{
	border-left-color: <?php echo get_option('color1'); ?>;
	
}
.show-ticket-mbn , .axtion-farnam-list .woocommerce-button , .product-style.htpp.ir-owl.offer-00-1.slide-new-4-slide .time1.mini-1-time , .owl-slide-new-5 .current .item-thumbin {
		border-color: <?php echo get_option('color1'); ?> !important;	

}
.menu-item-has-children:hover a::after , .farnam-offer-slider-1 .pricr-offer ins::before  {
		border-bottom-color: <?php echo get_option('color1'); ?>;
}
	.left-rr-user {
		box-shadow: 0 5px 15px <?php echo get_option('color2'); ?> !important;
	}
		
.replay-bala-34534mbn strong::before  , .irantest-ticket-form-mbn .wast-btn.wast-btn-success , .show-ticket-mbn:hover , .wast-wrapper .wast-filter.wast-clearfix.list-filter-dsfsfferer32243 .wast-custom-select-item.selected  , .ticket-tak-2:hover .ticket-title-mbn::before , .wast-wrapper .wast-custom-select-item.wast-custom-select-item--selected , .number-ticket-23423 span , #newheadsearch .dgwt-wcas-search-submit , .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3 .sabadnumbercolor , .mifgdfg-34534 .button.add_to_cart_button.added.rangi-1 , .mini-cart-3 .woocommerce-mini-cart__buttons .button:nth-child(2) , .irs-from, .irs-to, .irs-single , .farnam-offer-slider-1  .owl-dot.active , .farnam-offer-slider-1 .mini-1-time {
	background: <?php echo get_option('color1'); ?> !important;	
}
.woocommerce .widget_price_filter .ui-slider .ui-slider-range , .woocommerce #respond input#submit.alt.disabled, .woocommerce #respond input#submit.alt.disabled:hover, .woocommerce #respond input#submit.alt:disabled, .woocommerce #respond input#submit.alt:disabled:hover, .woocommerce #respond input#submit.alt:disabled[disabled], .woocommerce #respond input#submit.alt:disabled[disabled]:hover, .woocommerce a.button.alt.disabled, .woocommerce a.button.alt.disabled:hover, .woocommerce a.button.alt:disabled, .woocommerce a.button.alt:disabled:hover, .woocommerce a.button.alt:disabled[disabled], .woocommerce a.button.alt:disabled[disabled]:hover, .woocommerce button.button.alt.disabled, .woocommerce button.button.alt.disabled:hover, .woocommerce button.button.alt:disabled, .woocommerce button.button.alt:disabled:hover, .woocommerce button.button.alt:disabled[disabled], .woocommerce button.button.alt:disabled[disabled]:hover, .woocommerce input.button.alt.disabled, .woocommerce input.button.alt.disabled:hover, .woocommerce input.button.alt:disabled, .woocommerce input.button.alt:disabled:hover, .woocommerce input.button.alt:disabled[disabled], .woocommerce input.button.alt:disabled[disabled]:hover  , .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt {
		background-color: <?php echo get_option('color1'); ?>;	

}
.irs-from::after, .irs-to::after, .irs-single::after , .spinner {
	border-top-color: <?php echo get_option('color1'); ?> !important;
}


.ht-row.roozaye-barfi.iran-gaj-listmahsool.panjere-99-001-1400 h5 .spand4433 {
	border-bottom-color: <?php echo get_option('color1'); ?> ;
}

.left-rr-user , .mizan , .price-kharid .single_add_to_cart_button.button.alt , .woocommerce div.product .woocommerce-tabs ul.tabs li.active , .ps1-1 .mizan , .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button
, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt , .woocommerce-MyAccount-navigation-link.is-active a , .in1 img 
, .category-111 , .wpfFilterButton.wpfButton {
box-shadow: 0 5px 15px <?php echo get_option('color2'); ?>;
}
.dokan-dashboard .dokan-dash-sidebar ul.dokan-dashboard-menu li.active:hover , 


.ui-slider .ui-slider-range , .mehrnoosh-custom-checkbox input:checked ~ .checkmark , input:checked + .slider , .dokan-dashboard .dokan-dash-sidebar ul.dokan-dashboard-menu li.active, .dokan-dashboard .dokan-dash-sidebar ul.dokan-dashboard-menu li.active, .dokan-dashboard .dokan-dash-sidebar ul.dokan-dashboard-menu li.dokan-common-links a:hover

	{
	background-color: <?php echo get_option('color1'); ?> !important;	
	}
	

 .lahze-offer .product-list-1.ps3.jjj-112 .darsad , .darsad-7 , .farnam-offer-slider-1 .pricr-offer ins , .dakhel-offer-12 ,
.pricr-offer {
	background: <?php echo get_option('color3'); ?> !important;	
	}
	
	
	.show-ticket-mbn svg path, .show-ticket-mbn svg circle {
		
		stroke: <?php echo get_option('color1'); ?> !important;	
		 
	}
	
	
</style>
<?php }
add_action('wp_head', 'my_favicon');

add_action('woocommerce_checkout_create_order_line_item', function ($item, $cart_item_key, $values, $order) {
    $product = $item->get_product();

    if ($product) {
        $regular_price = $product->get_regular_price();
        $sale_price = $item->get_subtotal() / $item->get_quantity();

        $item->update_meta_data('_regular_price_at_purchase', $regular_price);
        $item->update_meta_data('_sale_price_at_purchase', $sale_price);
    }
}, 10, 4);

add_action('template_redirect', 'redirect_dokan_edit_account_to_wc');

function redirect_dokan_edit_account_to_wc() {
    if (is_user_logged_in() && strpos($_SERVER['REQUEST_URI'], 'dashboard/edit-account') !== false) {
        wp_redirect(wc_get_account_endpoint_url('edit-account'));
        exit;
    }
}
