מאגר מעולה לקודים לוורדפרס ואלמנטור

להלן רשימת הקודים מאת היוזר שסק

https://www.thiscodeworks.com/user/Shesek

 

 

 

define('MEDIA_TRASH', true);
content_copy

 

הסתרת גרסת WP

// remove wp version number from scripts and styles
function remove_css_js_version( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );


// remove wp version number from head and rss
function artisansweb_remove_version() {
    return '';
}
add_filter('the_generator', 'artisansweb_remove_version');
add_action( 'woocommerce_before_cart', 'calculator_free_shipping_cart_notice' );
  
function calculator_free_shipping_cart_notice() {
  
   $min_amount = 350; //change this to your free shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {
      $added_text = ' עוד ' . wc_price( $min_amount - $current ) . ' ויש לכם שליח עד הבית בחינם!';
      $return_to = wc_get_page_permalink( 'home' );
      $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'הוסיפו פריטים לסל למשלוח חינם', $added_text );
      wc_print_notice( $notice, 'notice' );
   }
  
}

add_action( 'woocommerce_before_checkout_form', 'free_shipping_cart_notice' );
  
function free_shipping_cart_notice() {
  
   $min_amount = 350; //change this to your free shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {
      $added_text = ' עוד ' . wc_price( $min_amount - $current ) . ' ויש לכם שליח עד הבית בחינם!';
      $return_to = wc_get_page_permalink( 'home' );
      $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'הוסיפו פריטים לסל למשלוח חינם', $added_text );
      wc_print_notice( $notice, 'notice' );
   }
  
}
add_filter('gettext', function($translation, $text, $domain) {
    if ($text === 'Remove'
) {
        $translation = 'הסרה';
    }
 
    return $translation;
}, 10, 3);
oninput="setCustomValidity('')"
* This piece of code will hide fields for the chosen method.
.hide_pickup {
    display: none !important;
}
*/
 
// Hide Local Pickup shipping method
add_filter( 'woocommerce_checkout_fields', 'hide_local_pickup_method' );
function hide_local_pickup_method( $fields_pickup ) {
    // change below for the method
    $shipping_method_pickup ='local_pickup:4';
    // change below for the list of fields. Add (or delete) the field name you want (or don’t want) to use
    $hide_fields_pickup = array( 'billing_company', 'billing_country', 'billing_postcode', 'billing_address_1', 'billing_address_2' , 'billing_city', 'billing_state');
 
    $chosen_methods_pickup = WC()->session->get( 'chosen_shipping_methods' );
    $chosen_shipping_pickup = $chosen_methods_pickup[0];
 
    foreach($hide_fields_pickup as $field_pickup ) {
        if ($chosen_shipping_pickup == $shipping_method_pickup) {
            $fields_pickup['billing'][$field_pickup]['required'] = false;
            $fields_pickup['billing'][$field_pickup]['class'][] = 'hide_pickup';
        }
        $fields_pickup['billing'][$field_pickup]['class'][] = 'billing-dynamic_pickup';
    }
    return $fields_pickup;
}
// Local Pickup - hide fields
add_action( 'wp_head', 'local_pickup_fields', 999 );
function local_pickup_fields() {
    if (is_checkout()) :
    ?>
    <style>
        .hide_pickup {display: none!important;}
    </style>
    <script>
        jQuery( function( $ ) {
            if ( typeof woocommerce_params === 'undefined' ) {
                return false;
            }
            $(document).on( 'change', '#shipping_method input[type="radio"]', function() {
                // change local_pickup:4 accordingly
            $('.billing-dynamic_pickup').toggleClass('hide_pickup', this.value == 'local_pickup:4');
            });
        });
    </script>
    <?php
    endif;
}
/**
 * Hide shipping rates when free shipping is available.
 *
 * @param array $rates Array of rates found for the package.
 * @return array
 */
function my_hide_shipping_when_free_is_available( $rates ) {
	$free = array();
	foreach ( $rates as $rate_id => $rate ) {
		if ( 'free_shipping' === $rate->method_id ) {
			$free[ $rate_id ] = $rate;
			break;
		}
	}
	return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );
add_filter( 'style_loader_src', function($href){
if(strpos($href, "//fonts.googleapis.com/") === false) {
return $href;
}
return false;
});
<script type="text/javascript">
  jQuery(".ur-section").click(function(){
  jQuery(this).wrap("<a href="http://google.com"></a>");});
</script>
<script type="text/javascript">
  jQuery(".ur-section").click(function(){
  jQuery(this).wrap("<a href="http://google.com"></a>");});
</script>
// Edit WooCommerce dropdown menu item of shop page//
// Options: menu_order, popularity, rating, date, price, price-desc
 
function my_woocommerce_catalog_orderby( $orderby ) {
    unset($orderby["rating"]);
    unset($orderby["date"]);
    return $orderby;
}
add_filter( "woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20 );
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
  
    // Change Out of Stock Text
    if ( ! $_product->is_in_stock() ) {
        $availability['availability'] = __('Sold Out', 'woocommerce');
    }
    return $availability;
}
define( 'WP_MEMORY_LIMIT', '512M' );
add_action( 'woocommerce_after_cart', 'seger_notice_cart_hodula' );
 
function seger_notice_cart_hodula() {
echo '
<style>
p.notice-seger-cart{
	background-color:#f1f1f1!important;
	font-size:16px;
	border:1px solid #eee;
	display: block;
    padding: 20px;
	color:black;
	box-shadow:2px 2px 2px grey;
	margin-top:20px;
}
</style>
<p class="notice-seger-cart"><b style="font-size:18px;">שימי לב 💗</b><br>
בעקבות הסגר החלטנו לספסד את מחיר שירות המשלוחים עד הבית ל<u>20 ₪ בלבד.</u>
</p>';
}
/*
* Changing the maximum quantity to 1 for all the WooCommerce products
*/

function woocommerce_quantity_input_max_callback( $max, $product ) {
	$max = 1;  
	return $max;
}
add_filter( 'woocommerce_quantity_input_max', 'woocommerce_quantity_input_max_callback', 10, 2 );
?>
<a href="Document - Full Url">להורדת המסמך המצורף</a>
// Get WooCommerce product name by ID via shortcode: [iw_product_name id='']
function iw_product_name_shortcode( $atts ) {
    $atts = shortcode_atts( array(
        'id' => null,
    ), $atts, 'bartag' );

    $html = '';

    if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
		$_product = wc_get_product( $atts['id'] );
		$html = $_product->get_title();
    }
    return $html;
}
add_shortcode( 'iw_product_name', 'iw_product_name_shortcode' );
/**
* WhatsApp button in product archive
*/
add_action('woocommerce_after_shop_loop_item', 'add_a_custom_button', 5 );
function add_a_custom_button() {
    global $product;

    // Not for variable and grouped products that doesn't have an "add to cart" button
    if( $product->is_type('variable') || $product->is_type('grouped') ) return;

    // Output the custom button linked to the product
    echo '<div style="margin-bottom:10px;">
        <a class="button custom-button" target="blank" href="https://api.whatsapp.com/send?phone=22222222&text=' . esc_attr( $product->get_title() ) . '">' . _('שלח ווטסאפ') . '</a>
    </div>';
}
add_filter( 'woocommerce_default_address_fields', 'customise_postcode_fields' );
function customise_postcode_fields( $address_fields ) {
    $address_fields['postcode']['required'] = false;

    return $address_fields;
}
/**
 * Woocommerce redirect to checkout after add to cart
 */
add_filter( 'woocommerce_add_to_cart_redirect', 'barbareshet_skip_cart_redirect_checkout' );

function barbareshet_skip_cart_redirect_checkout( $url ) {
	return wc_get_checkout_url();
}
//Disable plugin auto-update email notificationadd_filter('auto_plugin_update_send_email', '_return_false'); //Disable theme auto-update email notificationadd_filter('auto_theme_update_send_email', '_return_false');
function _enable_vcard_upload( $mime_types ){
  	$mime_types['vcf'] = 'text/vcard';
	$mime_types['vcard'] = 'text/vcard';
  	return $mime_types;
}
add_filter('upload_mimes', '_enable_vcard_upload' );
define('ALLOW_UNFILTERED_UPLOADS', true);
function exclude_category_from_search($query) {
	if ($query->is_search) {
		$cat_id = get_cat_ID('politics');
		$query->set('cat', '-'.$cat_id);
	}
	return $query;
}
add_filter('pre_get_posts','exclude_category_from_search');
function get_repeater_data(){	
		$repeater = get_post_meta(  get_the_ID(), 'repeater_name', true );
					$result = array();
					foreach ($repeater as $item => $repeater_item) {
						foreach ($repeater_item as $field => $value) {
							if ($field == 'repeater_field') {
							array_shift($result, $repeater_item);
								$current = $value;
								array_push($result, $value);
							}
						}
					}
					
					return $result[repeater_index];

		
}
add_shortcode( 'repeater_data', 'get_repeater_data' );
// remove wp version number from scripts and styles
function remove_css_js_version( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );


// remove wp version number from head and rss
function artisansweb_remove_version() {
    return '';
}
add_filter('the_generator', 'artisansweb_remove_version');
add_action( 'woocommerce_before_cart', 'bbloomer_free_shipping_cart_notice' );
  
function bbloomer_free_shipping_cart_notice() {
  
   $min_amount = 350; //change this to your free shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {
$added_text = ' בכדי לקבל משלוח חינם עליך לרכוש בסכום מעל 350 ש"ח הוסף מוצרים בסך ' . wc_price( $min_amount - $current ) . ' נוספים!';      $return_to = wc_get_page_permalink( 'shop' );
      $notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'המשך בקניות', $added_text );
      wc_print_notice( $notice, 'notice' );
   }
}
add_action( 'woocommerce_before_cart', 'computec_shipping_cart_notice' );
  
function computec_shipping_cart_notice() {
  
   $min_amount = 150; //change this to your shipping threshold
   
   $current = WC()->cart->subtotal;
  
   if ( $current < $min_amount ) {

	$added_text = ' אנו מבצעים משלוחים מסכום של 150 ש"ח ומעלה הוסף מוצרים בסך ' . wc_price( $min_amount - $current ) . ' נוספים!';       
	$return_to = wc_get_page_permalink( 'shop' );
	$notice = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), 'המשך בקניות', $added_text );
	wc_print_notice( $notice, 'notice' );
   }
}
.class{
 text-indent: -9999px;
 line-height: 0;
{



 your-class::after {
    content: "הטקסט שלך";
    text-indent: 0px;
    display: block;
    line-height: initial;
}
.class {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
// Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
	// Only run in the Cart or Checkout pages
	if( is_cart() || is_checkout() ) {
		global $woocommerce;

		// Set minimum cart total
		$minimum_cart_total = 500;

		// Total we are going to be using for the Math
		// This is before taxes and shipping charges
		$total = WC()->cart->subtotal;
		
		// Compare values and add an error is Cart's total
	    // happens to be less than the minimum required before checking out.
		// Will display a message along the lines of
		// A Minimum of 10 USD is required before checking out. (Cont. below)
		if( $total <= $minimum_cart_total  ) {
			// Display our error message
			wc_add_notice( sprintf( '<strong>A Minimum of %s %s is required before checking out.</strong>'
				.'<br />Current cart\'s total: %s %s',
				$minimum_cart_total,
				get_option( 'woocommerce_currency'),
				$total,
				get_option( 'woocommerce_currency') ),
			'error' );
		}
	}
}
<script type="text/javascript">
document.getElementById("clickSec").onclick = myFunction;
function myFunction () {
window.open("https://name.co.il", "_self");
}
</script>
add_action('wp_footer', function() {
?>

<script>
    const shareButton = document.querySelector('.share-button a');
    shareButton.addEventListener('click', event => {
    
        if (navigator.share) { 
        
            navigator.share({
                title: '<?php echo get_the_title(); ?>',
                url: '<?php echo get_permalink(); ?>'
            }).then(() => {
            })
            .catch(console.error);
        }
    });
	</script>

<?php
});
<script>
//The event is submit_success so you can catch it for example: jQuery( document ).ready(function( $ ){ 	$( document ).on('submit_success', function(){ 		// form has been submitted 		window.open('YOUR URL', '_blank'); 	}); });
</script>
<script>
//The event is submit_success so you can catch it for example: jQuery( document ).ready(function( $ ){ 	$( '#FORM_ID_HERE' ).on('submit_success', function(){ 		// form has been submitted 		window.open('YOUR URL', '_blank'); 	}); });
</script>
// Move Coupon Code To Order Review
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_coupon_form', 5 );
// user creation with Hebrew usernames //function to transliterate username function convert_user_nicename($hebrew_username) { $charset = array('א'=>'a','ב'=>'b','ג'=>'g','ד'=>'d','ה'=>'h','ו'=>'v','ז'=>'z','ח'=>'h','ט'=>'t','י'=>'y','ך'=>'k','כ'=>'k','ל'=>'l','ם'=>'m','מ'=>'m','ן'=>'n','נ'=>'n','ס'=>'s','ע'=>'e','ף'=>'p','פ'=>'p','ץ'=>'ts','צ'=>'ts','ק'=>'q','ר'=>'r','ש'=>'sh','ת'=>'t'); $latin_user_slug = ''; $chars = mbStringToArray($hebrew_username); foreach ($chars as $key =>$char) { $latin_user_slug .= $charset[$char]; } return($latin_user_slug); } function mbStringToArray ($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string,0,1,"UTF-8"); $string = mb_substr($string,1,$strlen,"UTF-8"); $strlen = mb_strlen($string); } return $array; } // remove the filter remove_filter( 'pre_user_nicename', 'filter_pre_user_nicename', 10, 1 ); function filter_pre_user_nicename($user_nicename) { $heb = html_entity_decode($user_nicename); $user_nicename = convert_user_nicename($heb); return $user_nicename; }; // add new filter add_filter( 'pre_user_nicename', 'filter_pre_user_nicename', 10, 1 );
@import url('https://fonts.googleapis.com/css2?family=Assistant&display=swap');

#template_header h1, #template_header .subtitle, #body_content_inner, .td, .text, #template_body h2, #template_body h2 a, #template_body h3, #template_footer a.ft-social-link, #template_footer #credit {
font-family: 'Assistant', sans-serif!important;
}
* Sorting out of stock WooCommerce products  Order product collections by stock status, in-stock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_array(‘woocommerce/woocommerce.php’, apply_filters(‘active_plugins’, get_option(‘active_plugins’)))) {
add_filter(‘posts_clauses’, array($this, order_by_stock_status’), 2000);
}
}
public function order_by_stock_status($posts_clauses)
{
global $wpdb;
// only change query on WooCommerce loops
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag())) {
$posts_clauses[‘join’] .=  INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) “;
$posts_clauses[‘orderby’] =  istockstatus.meta_value ASC,  . $posts_clauses[‘orderby’];
$posts_clauses[‘where’] =  AND istockstatus.meta_key = _stock_status AND istockstatus.meta_value <>   . $posts_clauses[‘where’];
}
return $posts_clauses;
}
}
new iWC_Orderby_Stock_Status;
/**
* END – Order product collections by stock status, instock products first.
*/
//// Validate if Email field is spam
add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
    // Looking if email found in spam array, you can add to the array
  $spamemails = array("[email protected]", "[email protected]");
    if ( in_array( $field['value'] , $spamemails) ) {
        $ajax_handler->add_error( $field['id'], 'אנחנו לא אוהבים ספאם, נסו מייל אחר' );
    }
}, 10, 3 );
function (debug) {
    var w = debug.documentElement.offsetWidth,
        t = debug.createTreeWalker(debug.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
        if (b.right > w || b.left < 0) {
            t.currentNode.style.setProperty('outline', '1px dotted red', 'important');
            console.log(t.currentNode);
        }
    };
}(document));
<script>
jQuery("input , textarea").focus(function(){
  jQuery(this).parents('.elementor-field-group').addClass('focused');
});

jQuery("input , textarea").blur(function(){
  var inputValue = jQuery(this).val();
  if ( inputValue == "" ) {
    jQuery(this).parents('.elementor-field-group').removeClass('focused');  
  }
});
</script>
.marquee {
  height: 660px;
  border: 0px solid #eee;
  box-sizing: border-box;
  position: relative;
  margin: 0px auto;
  animation: marquee 30s linear infinite;
}

.marquee:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% { top: 50%; }
  100% { top: -300%; }
}
add_action( 'elementor/element/section/section_typo/after_section_start', function( $element, $args ) {
	/** @var \Elementor\Element_Base $element */
	$element->add_control(
		'custom_control_typo',
		[
			'type' => \Elementor\Controls_Manager::TEXT,
			'label' => __( 'Custom Font', 'plugin-name' ),
			'dynamic' => [
					'active' => true,
				],
			 'selectors' => [
                '{{WRAPPER}} h2, {{WRAPPER}} p, {{WRAPPER}} a' => 'font-family: {{VALUE}}!important'
            ],
			
		]
	);
}, 10, 2 );
 * @snippet       Hide ALL shipping rates in ALL zones when Free Shipping is available
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=260
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.6.3
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
  
add_filter( 'woocommerce_package_rates', 'bbloomer_unset_shipping_when_free_is_available_all_zones', 10, 2 );
   
function bbloomer_unset_shipping_when_free_is_available_all_zones( $rates, $package ) {
      
$all_free_rates = array();
     
foreach ( $rates as $rate_id => $rate ) {
      if ( 'free_shipping' === $rate->method_id ) {
         $all_free_rates[ $rate_id ] = $rate;
         break;
      }
}
     
if ( empty( $all_free_rates )) {
        return $rates;
} else {
        return $all_free_rates;
} 
 
}
/** * Change a currency symbol */
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); 
function change_existing_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'ILS': $currency_symbol = 'ILS'; break; } return $currency_symbol;}
// Set WooCommerce Virtual Order Status to Complete After Payment
add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 );
function virtual_order_payment_complete_order_status( $order_status, $order_id ) {
  $order = new WC_Order( $order_id );
  if ( 'processing' == $order_status &&
       ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) {
    $virtual_order = null;
    if ( count( $order->get_items() ) > 0 ) {
      foreach( $order->get_items() as $item ) {
        if ( 'line_item' == $item['type'] ) {
          $_product = $order->get_product_from_item( $item );
          if ( ! $_product->is_virtual() ) {
            // once we've found one non-virtual product we know we're done, break out of the loop
            $virtual_order = false;
            break;
          } else {
            $virtual_order = true;
          }
        }
      }
    }
    // virtual order, mark as completed
    if ( $virtual_order ) {
      return 'completed';
    }
  }
  // non-virtual order, return original status
  return $order_status;
}
add_filter( 'woocommerce_sale_flash', 'navarro_change_badge_to_percentage', 10, 3 );


function navarro_change_badge_to_percentage( $html, $post, $product ) {

	$price = intval( ( $product instanceof WC_Product_Variable ) ? $product->get_variation_regular_price() : $product->get_regular_price() );
	
	$sale = intval( ( $product instanceof WC_Product_Variable ) ? $product->get_variation_sale_price() : $product->get_sale_price() );

	$percent = floor( 100 - ( $sale * 100 / $price ) );

	return sprintf( '<div class="onsale-wrapper"><span class="onsale">%s%% %s</span></div>', $percent, __( 'הנחה', 'woocommerce' ) );

}
function search_by_sku( $search, &$query_vars ) {
    global $wpdb;
    if(isset($query_vars->query['s']) && !empty($query_vars->query['s'])){
        $args = array(
            'posts_per_page'  => -1,
            'post_type'       => 'product',
            'meta_query' => array(
                array(
                    'key' => '_sku',
                    'value' => $query_vars->query['s'],
                    'compare' => 'LIKE'
                )
            )
        );
        $posts = get_posts($args);
        if(empty($posts)) return $search;
        $get_post_ids = array();
        foreach($posts as $post){
            $get_post_ids[] = $post->ID;
        }
        if(sizeof( $get_post_ids ) > 0 ) {
                $search = str_replace( 'AND (((', "AND ((({$wpdb->posts}.ID IN (" . implode( ',', $get_post_ids ) . ")) OR (", $search);
        }
    }
    return $search;
    
}
    add_filter( 'posts_search', 'search_by_sku', 999, 2 );
add_action('woocommerce_before_single_product', 'check_if_variable_first');
function check_if_variable_first()
{
    if (is_product()) {
        global $post;
        $product = wc_get_product($post->ID);
        if ($product->is_type('variable')) {
            // removing the price of variable products remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); // Variable product only if($product->is_type('variable')):

?>
            <style>
                div.woocommerce-variation-price,
                div.woocommerce-variation-availability,
                div.hidden-variable-price {
                    height: 0px !important;
                    overflow: hidden;
                    position: relative;
                    line-height: 0px !important;
                    font-size: 0% !important;
                }
            </style>
            <script>
                jQuery(document).ready(function($) {
                    $('input.variation_id').on('change',function() {
                        if ('' != $('input.c').val()) {
                            $('p.price').html($('div.woocommerce-variation-price > span.price').html()).append('<p class="availability">' + $('div.woocommerce-variation-availability').html() + '</p>');
                            console.log($('input.variation_id').val());
                        } else {
                            $('p.price').html($('div.hidden-variable-price').html());
                            if ($('p.availability'))
                                $('p.availability').remove();
                            console.log('NULL');
                        }
                    });
                });
            </script>
<?php

            echo '<p class="prrice">' . $price . '</p>
    <div class="hidden-variable-price" >' . $price . '</div>';
        }
    }
}
   var image_to_show = '';
    var variations = JSON.parse($(".variations_form").attr("data-product_variations"));
    if(variations) {
        var first_attr = Object.keys(variations[0].attributes)[0];
        // when swatch button is clicked
        $("ul[data-attribute_name='"+first_attr+"'] li").click(function() {
            var choice = $(this).attr("data-value");
            var found = false;
            // loop variations JSON
            for(const i in variations) {
                if(found) continue;
                if(variations.hasOwnProperty(i)) {
                    // if first attribute has the same value as has been selected
                    if (choice === variations[i].attributes[Object.keys(variations[0].attributes)[0]]) {
                        // change featured image
                        image_to_show = variations[i].image_src;
                        found = true;
                    }
                }
            }
        });

        // after woo additional images has changed the image, change it again
        jQuery(".variations_form").on("wc_additional_variation_images_frontend_image_swap_done_callback", function() {
            if(image_to_show.length) {
                $(".attachment-shop_single").attr("src", image_to_show).removeAttr("srcset");
            }
        });

    }
function get_jet_meta_fields($field_name,$slug,$field_num){
	add_filter('elementor_pro/forms/field_types', function ($types) use ($field_name) {
	    $types[$field_name] = ucfirst($field_name);
	    return $types;		
	});
	add_filter('elementor_pro/forms/render/item/'.$field_name, function ($item, $item_index, $instance) use ($slug,$field_num) {
	    ob_start();
	    global $wpdb;
	    // this adds the prefix which is set by the user upon instillation of wordpress
	    $table_name = $wpdb->prefix . "jet_post_types";
	    // this will get the data from your table
	    // id,slug,status,labels,args,meta_fields
	    $retrieve_data = $wpdb->get_results( "SELECT slug,args,meta_fields FROM $table_name" );
		$all_mata_fields = unserialize($retrieve_data[$slug]->meta_fields);
		$select_options = $all_mata_fields[$field_num]["options"];
	    $field_options = [];
	    foreach ($select_options as $key => $val) {
	    $field_options[] = $select_options[$key]['value']. "|".$select_options[$key]['key'];
	    }
	    $item['field_options'] = implode("\n", $field_options);
	    $item['field_type'] = "select";
	    ob_get_clean();
	    return $item;
	},99,3);
}

get_jet_meta_fields('locations',1,5);
get_jet_meta_fields('vacancy',1,6);
add_action( 'woocommerce_cart_calculate_fees', 'elex_discount_price' ); 

function elex_discount_price() 

{ 

global $woocommerce; //Set the price for user role. 

$discount_price = 5; 

$set_role = array('administrator','vendor'); //Get the login user role 

$user = wp_get_current_user(); 

$user_role = $user->roles; //Check the specifc user role for discount. 

if( in_array( $user_role[0] , $set_role ) )

{ 

$woocommerce->cart->add_fee( 'Discounted Price', -$discount_price, true, 'standard' ); 

} 

}
function sv_discount_price_percentage($cart) {

    global $woocommerce; //Set the price for user role.

    $discount_percentage = 0.1;
	//כל 0.1 שווה ל10 אחוז


    $set_role = array('administrator', 'vendor'); //Get the login user role
    $user = wp_get_current_user();


    $percentage_fee = ($cart->cart_contents_total + $cart->shipping_total) * $discount_percentage;

    $user_role = $user->roles; //Check the specifc user role for discount.
    if (in_array($user_role[0], $set_role)) {

        $cart->add_fee('הנחה באחוזים', -$percentage_fee, true);
    }
}

add_action('woocommerce_cart_calculate_fees', 'sv_discount_price_percentage');
content_copy

 

התקנת SMTP

function Computec_send_mail_using_smtp( $phpmailer ) {

$phpmailer->isSMTP();

$phpmailer->IsHTML(true);

$phpmailer->Host = 'smtp.gmail.com';

$phpmailer->Port = 587;

$phpmailer->Username = '[email protected]';

$phpmailer->Password = 'some password';

$phpmailer->SMTPAuth = true;

$phpmailer->SMTPSecure = 'tls';

$phpmailer->From = '[email protected]';

$phpmailer->FromName = get_bloginfo( 'name' );

}

add_action( 'phpmailer_init', 'Computec_send_mail_using_smtp' );
/* -- header -- */
@media (min-width: 768px){
	selector .elementor-nav-menu > li:after{
        content: "";
        position: absolute;
        display: inline-block;
        width: 1px;
	    height: 1rem;
	    top: 0;
	    bottom:0;
	    left:0;
	    margin: auto;
	    opacity: 0.5;
	    color:var(--e-global-color-primary);
	}
	selector .elementor-nav-menu > li:last-child:after {
		content: "";
	}
}
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );

function virtual_products_less_fields( $fields ) {

    $virtual_products = true;

    foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

        if ( ! $cart_item['data']->is_virtual() ) $virtual_products = false;
    }

    if( $virtual_products===true) {
        unset($fields['billing']['billing_company']);
        unset($fields['billing']['billing_address_1']);
        unset($fields['billing']['billing_address_2']);
        unset($fields['billing']['billing_city']);
        unset($fields['billing']['billing_postcode']);
        unset($fields['billing']['billing_country']);
        unset($fields['billing']['billing_state']);
        unset($fields['billing']['billing_phone']);

        add_filter( 'woocommerce_enable_order_notes_field', '__return_false',9999 );
    }

    return $fields;

}
// Automatically set the image Title, Alt-Text, Caption & Description upon upload
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' );
function my_set_image_meta_upon_image_upload( $post_ID ) {
 
    // Check if uploaded file is an image, else do nothing
 
    if ( wp_attachment_is_image( $post_ID ) ) {
 
        $my_image_title = get_post( $post_ID )->post_title;
 
        // Sanitize the title:  remove hyphens, underscores & extra spaces:
        $my_image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ',  $my_image_title );
 
        // Sanitize the title:  capitalize first letter of every word (other letters lower case):
        $my_image_title = ucwords( strtolower( $my_image_title ) );
 
        // Create an array with the image meta (Title, Caption, Description) to be updated
        // Note:  comment out the Excerpt/Caption or Content/Description lines if not needed
        $my_image_meta = array(
            'ID'        => $post_ID,            // Specify the image (ID) to be updated
            'post_title'    => $my_image_title,     // Set image Title to sanitized title
            'post_excerpt'  => $my_image_title,     // Set image Caption (Excerpt) to sanitized title
            'post_content'  => $my_image_title,     // Set image Description (Content) to sanitized title
        );
 
        // Set the image Alt-Text
        update_post_meta( $post_ID, '_wp_attachment_image_alt', $my_image_title );
 
        // Set the image meta (e.g. Title, Excerpt, Content)
        wp_update_post( $my_image_meta );
 
    } 
}
/** 
* The BetterPluginCompatibilityControl class
*
* @package WordPress_Plugins
* @subpackage BetterPluginCompatibilityControl
* @since 1.0
* @author [email protected]
*/
class BetterPluginCompatibilityControl {
	private static $instance = null;

	/**
	 * Creates or returns an instance of this class.
	 */
	public static function get_instance() {
		if( null == self::$instance ) {
			self::$instance = new self;
		}

		return self::$instance;
	}
	
	/**
 	* The BetterPluginCompatibilityControl class constructor
 	* initializing required stuff for the plugin
 	*
 	* @since 1.0
 	* @author [email protected]
 	*/
	function __construct() {
		if ( !BPCCISWP29 ) {
			add_action('admin_notices', array(&$this, 'wpVersionFailed'));
			return;
		}
		
		$this->localeInfo = localeconv();
		
		add_action('plugins_loaded', array(&$this, 'bpcc_load_textdomain'));
		add_action('admin_init', array(&$this, 'bpcc_init'));
	}
	
	
	/**
 	* Initialize and load the plugin stuff
 	*
 	* @since 1.0
 	* @uses $pagenow
 	* @author [email protected]
 	*/
	function bpcc_init() {
		global $pagenow;
		if ( !function_exists("add_action") ) return;
		
		
		if((defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE || defined('MULTISITE') && MULTISITE) && function_exists('is_network_admin') && is_network_admin()) {
			add_filter('network_admin_plugin_action_links', array(&$this, 'bpcc_pluginversioninfo'), 10, 2);
			if( current_user_can( 'manage_network_plugins' ) ) {
				add_filter('plugin_action_links', array(&$this, 'bpcc_pluginversioninfo'), 10, 2);
			}
		} else {
			if( current_user_can( 'install_plugins' ) ) {
				add_filter('plugin_action_links', array(&$this, 'bpcc_pluginversioninfo'), 10, 2);
			}
		}
		
		if( $pagenow == 'plugins.php' ) {
			add_action('admin_head', array(&$this, 'bpcc_css_admin_header'));
		}
	}


	/**
	 * Writes the css stuff into page header needed for the plugin to look good
	 *
	 * @since 1.0
	 * @author [email protected]
	 */
	function bpcc_css_admin_header() {
		echo '
<style type="text/css">
.bpcc_minversion {
	color: #aaa;
	text-shadow: 0 1px 0 #FFFFFF;
	cursor: help;
	padding: 0px;
	text-decoration: none;
	font-weight: 200;
}

.bpcc_maxversion {
	border-left-width: 0;
	color: #aaa;
	text-shadow: 0 1px 0 #FFFFFF;
	cursor: help;
	padding: 0px;
	text-decoration: none;
	font-weight: 200;
}

.bpcc_red {
	color: #a00;
	padding: 1px 2px;
	font-weight: bold;
}

.bpcc_green {
	color: #0a0;
	padding: 1px 2px;
}
</style>' . "\n";
	}
	
	
	/**
 	* Add plugin version dependency info
 	*
 	* @since 1.0
 	* @author [email protected]
 	*/
	function bpcc_pluginversioninfo( $links, $file ) {
		$_wpversion = str_replace($this->localeInfo["decimal_point"], ".", floatval($GLOBALS['wp_version'])) . ''; // Only get x.y.0 from WP version string
		
		$minpluginver = $maxpluginver = $minpluginvermajor = '';
		$bpcc_readme = WP_PLUGIN_DIR . '/' . dirname( $file ) . '/' . 'readme.txt';
		if( file_exists( $bpcc_readme ) ) {
			$pluginver_data = get_file_data( $bpcc_readme, array('requires' => 'Requires at least', 'tested' => 'Tested up to') );
			$minpluginver = $pluginver_data['requires'];
			$minpluginvermajor = str_replace($this->localeInfo["decimal_point"], ".", floatval($minpluginver)) . '';
			$maxpluginver = $pluginver_data['tested'];
			if( !empty($pluginver_data['tested']) ) $maxpluginver = $pluginver_data['tested'];
		} else {
			require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
			$info = plugins_api('plugin_information', array('fields' => array('tested' => true, 'requires' => true, 'rating' => false, 'downloaded' => false, 'downloadlink' => false, 'last_updated' => false, 'homepage' => false, 'tags' => false, 'sections' => false, 'compatibility' => false, 'author' => false, 'author_profile' => false, 'contributors' => false, 'added' => false), 'slug' => dirname( $file ) ));
			if (!is_wp_error($info)) {
				if( !empty($info->requires) ) {
					$minpluginver = $info->requires;
					$minpluginvermajor = str_replace($this->localeInfo["decimal_point"], ".", floatval($minpluginver)) . '';
				}
				if( !empty($info->tested) ) $maxpluginver = $info->tested;
			}
		}
		
		if( $minpluginver != '' || $maxpluginver != '' ) {
			$addminverclass = ( version_compare(trim( $minpluginvermajor ), $_wpversion, '>') ) ? ' bpcc_red' : ' bpcc_green';
			$addminvertitle = ( version_compare(trim( $minpluginvermajor ), $_wpversion, '>') ) ? __('Warning: This plugin has not been tested with your current version of WordPress.', 'better-plugin-compatibility-control') : __('This plugin has been tested successfully with your current version of WordPress.', 'better-plugin-compatibility-control');
			$addminverinfo = ( $minpluginver ) ? '<span class="bpcc_minversion' . $addminverclass . '" title="' . $addminvertitle . '">' . trim( $minpluginver ) . '</span>' : '<span class="bpcc_minversion" title="' . __('No compatibility info for this plugin available.', 'better-plugin-compatibility-control') . '">' . __('N/A', 'better-plugin-compatibility-control') . '</span>';
			
			$addmaxverclass = ( version_compare(trim( $maxpluginver ), $_wpversion, '<') ) ? ' bpcc_red' : ' bpcc_green';
			$addminvertitle = ( version_compare(trim( $maxpluginver ), $_wpversion, '<') ) ? __('Warning: This plugin has not been tested with your current version of WordPress.', 'better-plugin-compatibility-control') : __('This plugin has been tested successfully with your current version of WordPress.', 'better-plugin-compatibility-control');
			$addmaxverinfo = ( $maxpluginver ) ? '<span class="bpcc_maxversion' . $addmaxverclass . '" title="' . $addminvertitle . '">' . trim( $maxpluginver ) . '</span>' : '<span class="bpcc_maxversion" title="' . __('No compatibility info for this plugin available.', 'better-plugin-compatibility-control') . '">' . __('N/A', 'better-plugin-compatibility-control') . '</span>';
			
			$addverinfo = '<span class="bpcc_wrapper" style="white-space: normal;">' . $addminverinfo . '&ndash;' . $addmaxverinfo . '';
		} else {
			$addverinfo = '<span class="bpcc_wrapper" style="white-space: normal;"><span class="bpcc_maxversion" title="' . __('No readme.txt file for this plugin found. Contact the plugin author!', 'better-plugin-compatibility-control') . '">' . __('No compatibility data found', 'better-plugin-compatibility-control') . '</span></span>';
		}
		
		$links = array_merge( $links, array( $addverinfo ) );
		
		return $links;
	}
	
	
	/**
 	* Initialize and load the plugin textdomain
 	*
 	* @since 1.0
 	* @author [email protected]
 	*/
	function bpcc_load_textdomain() {
		load_plugin_textdomain('better-plugin-compatibility-control', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
	}
	
	
	/**
 	* Checks for the version of WordPress,
 	* and adds a message to inform the user
 	* if required WP version is less than 2.9
 	*
 	* @since 3.8.1.15
 	* @author [email protected]
 	*/
	function wpVersionFailed() {
		echo "<div id='wpversionfailedmessage' class='error fade'><p>" . __('Better Plugin Compatibility Control requires at least WordPress 2.9!', 'better-plugin-compatibility-control') . "</p></div>";
	}
	
}

if( is_admin() && class_exists('BetterPluginCompatibilityControl') && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) {
	add_action( 'plugins_loaded', array( 'BetterPluginCompatibilityControl', 'get_instance' ) );
}
/*
 * Adding the column
 */
function rd_user_id_column( $columns ) {
	$columns['user_id'] = 'ID';
	return $columns;
}
add_filter('manage_users_columns', 'rd_user_id_column');
 
/*
 * Column content
 */
function rd_user_id_column_content($value, $column_name, $user_id) {
	if ( 'user_id' == $column_name )
		return $user_id;
	return $value;
}
add_action('manage_users_custom_column',  'rd_user_id_column_content', 10, 3);
 
/*
 * Column style (you can skip this if you want)
 */
function rd_user_id_column_style(){
	echo '<style>.column-user_id{width: 5%}</style>';
}
add_action('admin_head-users.php',  'rd_user_id_column_style');
/* Disable Page Title */
function ele_disable_page_title( $return ) {
   return false;
}
add_filter( 'hello_elementor_page_title', 'ele_disable_page_title' );
// Disable support for comments and trackbacks in post types
function lenix_disable_comments_post_types_support() {
	$post_types = get_post_types();
	foreach ($post_types as $post_type) {
		if(post_type_supports($post_type, 'comments')) {
			remove_post_type_support($post_type, 'comments');
			remove_post_type_support($post_type, 'trackbacks');
		}
	}
}
add_action('admin_init', 'lenix_disable_comments_post_types_support');

// Close comments on the front-end
function lenix_disable_comments_status() {
	return false;
}
add_filter('comments_open', 'lenix_disable_comments_status', 20, 2);
add_filter('pings_open', 'lenix_disable_comments_status', 20, 2);

// Hide existing comments
function lenix_disable_comments_hide_existing_comments($comments) {
	$comments = array();
	return $comments;
}
add_filter('comments_array', 'lenix_disable_comments_hide_existing_comments', 10, 2);

// Remove comments page in menu
function lenix_disable_comments_admin_menu() {
	remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'lenix_disable_comments_admin_menu');

// Redirect any user trying to access comments page
function lenix_disable_comments_admin_menu_redirect() {
	global $pagenow;
	if ($pagenow === 'edit-comments.php') {
		wp_redirect(admin_url()); exit;
	}
}
add_action('admin_init', 'lenix_disable_comments_admin_menu_redirect');

// Remove comments metabox from dashboard
function lenix_disable_comments_dashboard() {
	remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'lenix_disable_comments_dashboard');

// Remove comments links from admin bar
function lenix_disable_comments_admin_bar() {
	if (is_admin_bar_showing()) {
		remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
	}
}
add_action('init', 'lenix_disable_comments_admin_bar');
content_copy

 

הרשאת SVG

/***** Allow SVG *****/
//===================
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {

  global $wp_version;
  if ( $wp_version !== '4.7.1' ) {
     return $data;
  }

  $filetype = wp_check_filetype( $filename, $mimes );

  return [
      'ext'             => $filetype['ext'],
      'type'            => $filetype['type'],
      'proper_filename' => $data['proper_filename']
  ];

}, 10, 4 );

function cc_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );

function fix_svg() {
  echo '<style type="text/css">
        .attachment-266x266, .thumbnail img {
             width: 100% !important;
             height: auto !important;
        }
        </style>';
}
add_action( 'admin_head', 'fix_svg' );
// Elementor Form Telephone Number Validition
//======================================
add_action( 'elementor_pro/forms/validation/tel', function( $field, $record, $ajax_handler ) { 	
	// Match this format XXXXXXXXXX, 1234567890 	
	if ( preg_match( '/[0-9]{10}/', $field['value'] ) !== 1 ) { 		
	$ajax_handler->add_error( $field['id'], 'הזן טלפון חוקי ללא מקף או רווח' ); 	
	}
 	}, 10, 3 );
function get_url_edge($atts) {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return basename($pageURL);
}
add_shortcode('urledge', 'get_url_edge');
/* Create Page Slug Shortcode*/
function page_slug_shordcode(){
	$slug = get_post_field( 'post_name');
	echo $slug;
}

add_shortcode( 'pageslug', 'page_slug_shordcode' );
function get_url($atts) {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
add_shortcode('url', 'get_url');
function remove_all_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
            remove_image_size( $size );
    }
}
 
add_action('init', 'remove_all_image_sizes');

add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' );
// This will remove the default image sizes and the medium_large size. 
function prefix_remove_default_images( $sizes ) {
 unset( $sizes['small']); // 150px
 unset( $sizes['medium']); // 300px
 unset( $sizes['large']); // 1024px
 unset( $sizes['medium_large']); // 768px
 return $sizes;
}
/**
 * Remove product data tabs
 */
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

    unset( $tabs['description'] );      	// Remove the description tab
    unset( $tabs['reviews'] ); 			// Remove the reviews tab
    unset( $tabs['about'] );  	// Remove the additional information tab
	unset( $tabs['additional_information'] );
	unset( $tabs['wcfm_product_store_tab'] );
	unset( $tabs['wcfm_enquiry_tab'] );

    return $tabs;
}
/**
 Display "Sold Out" on Loop Pages - WooCommerce
 */
 
add_action( 'woocommerce_before_shop_loop_item_title', 'bbloomer_display_sold_out_loop_woocommerce' );
 
function bbloomer_display_sold_out_loop_woocommerce() {
    global $product;
 
    if ( !$product->is_in_stock() ) {
        echo '<span class="soldout">' . __( 'אזל מהמלאי', 'woocommerce' ) . '</span>';
    }
}
/** unrequiered checkout fields**/
add_filter( 'woocommerce_default_address_fields', 'customise_postcode_fields' );
function customise_postcode_fields( $address_fields ) {
    $address_fields['postcode']['required'] = false;
    return $address_fields;
} 

add_filter( 'woocommerce_checkout_fields' , 'misha_not_required_fields', 9999 );
 
function misha_not_required_fields( $f ) {
 
	unset( $f['billing']['billing_postcode']['required'] );
	unset( $f['shipping']['shipping_postcode']['required'] );
 
	// the same way you can make any field required, example:
	// $f['billing']['billing_company']['required'] = true;
 
	return $f;
}
/**
*  Out of stock message for product variations.
* @param string $text default message.
* @return string
*/
function puri_out_of_stock_message( $text ){
 $text = 'המוצר אזל מהמלאי, לכניסה לרשימת המתנה, אנא צרו קשר!';
 return $text;
}
add_filter( 'woocommerce_out_of_stock_message', 'puri_out_of_stock_message', 999);
add_action( 'wp_head', function () { ?>
<style>

	.woocommerce-message, .woocommerce-info {
    border-top-color: var( --e-global-color-secondary );
}

.woocommerce-message::before, .woocommerce-info::before {
    color: var( --e-global-color-secondary );
}

</style>
<?php } );
jQuery(document).ready( () => {
jQuery("[name='first_name'], [name='last_name']").on('blur', () => {
jQuery("[name='full_name'").val(
jQuery("[name='first_name']").val() + " " + jQuery("[name='last_name']").val()) }) });
jQuery(document).ready( () => {
var url = location.search;
var title = url.substring(url.indexOf('full_name=')+10, url.length);
var title_decode = decodeURIComponent(title);

jQuery("[name='_title'").val(title_decode);
});
@media only screen and (max-width: 768px) {

}
/**
* Category ID Column on Category Page
* https://wordpress.org/support/topic/show-category-id-on-category-page-manager-in-admin/
*/
add_filter( 'manage_edit-category_columns', 'category_column_header' );

function category_column_header($columns) {
	$columns['header_name'] = 'Header Name for Display'; 
	return $columns;
}

add_filter( 'manage_category_custom_column', 'category_column_content', 10, 3 );

function category_column_content($content, $column_name, $term_id){
	return $term_id;
}
/* Category ID Column on Category Page Ends */
function add_post_tag_columns( $columns ) {
    $columns['id'] = 'Id';
    return $columns;
}
add_filter( 'manage_edit-product_cat_columns', 'add_post_tag_columns' );

function add_post_tag_column_content( $content, $column, $id ) {
    if ( 'id' === $column ) {
        $content = $id;
    }

    return $content;
}
add_filter( 'manage_product_cat_custom_column', 'add_post_tag_column_content', 10, 3 );
function remove_menu_items() {
	if( current_user_can( 'רמת יוזר' ) ){
        remove_menu_page( 'edit.php?post_type=elementor_library' );
		remove_menu_page( 'edit.php?post_type=page' );
		remove_menu_page( 'קישור של עמוד ' ); 
	}
}
add_action( 'admin_menu', 'remove_menu_items' );
<script>
jQuery( document ).ready( function( $ ) {
$("link[rel='icon']").attr("href", "FAVICON URL HERE")});
</script>
/**

 Display "Sold Out" on Loop Pages - WooCommerce

 */

 

add_action( 'woocommerce_before_shop_loop_item_title', 'bbloomer_display_sold_out_loop_woocommerce' );

 

function bbloomer_display_sold_out_loop_woocommerce() {

    global $product;

 

    if ( !$product->is_in_stock() ) {

        echo '<span class="soldout">' . __( 'אזל מהמלאי', 'woocommerce' ) . '</span>';

    }

} 



/**

* Change "Out of stock" to "Sold Out"

* @param string $text

* @param WC_Product $product

* @return string

*/

function puri_woocommerce_get_availability_text( $text, $product ) {

    if (!$product->is_in_stock()) {

        $text = 'המוצר אזל מהמלאי, לכניסה לרשימת המתנה, אנא צרו קשר!';

    } else {

    // You can add more conditions here. e.g if product is available.

    // $text = 'Available right now';

    }

    return $text;

}



add_filter( 'woocommerce_get_availability_text', 'puri_woocommerce_get_availability_text', 999, 2);



/**

*  Out of stock message for product variations.

* @param string $text default message.

* @return string

*/

function puri_out_of_stock_message( $text ){

 $text = 'המוצר אזל מהמלאי, לכניסה לרשימת המתנה, אנא צרו קשר!';

 return $text;

}

add_filter( 'woocommerce_out_of_stock_message', 'puri_out_of_stock_message', 999);
/**

 * @snippet       Display supplier @ WooCommerce Single Product Page

 * @how-to        Get CustomizeWoo.com FREE

 * @author        Rodolfo Melogli

 * @compatible    WC 4.
6
 * @donate $     https://businessbloomer.com/bloomer-armada/

 */

  
9
// -----------------------------------------

// 1. Add supplier field input @ product edit page

  

add_action( 'woocommerce_product_options_pricing', 'bbloomer_add_supplier_to_products' );      

  

function bbloomer_add_supplier_to_products() {          

    woocommerce_wp_text_input( array( 

        'id' => 'supplier', 

        'class' => 'short wc_input_price', 

        'label' => __( 'מחיר ספק', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',

        'data_type' => 'price', 

    ));      

}

  

// -----------------------------------------

// 2. Save supplier field via custom field

  

add_action( 'save_post_product', 'bbloomer_save_supplier' );

  

function bbloomer_save_supplier( $product_id ) {

    global $pagenow, $typenow;

    if ( 'post.php' !== $pagenow || 'product' !== $typenow ) return;

    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;

    if ( isset( $_POST['supplier'] ) ) {

        update_post_meta( $product_id, 'supplier', $_POST['supplier'] );

    }

}
add_filter('woocommerce_get_availability_text', 'Computec_change_soldout', 10, 2 );

/**
* Change Sold Out Text to Something Else
*/
function Computec_change_soldout ( $text, $product) {
if ( !$product->is_in_stock() ) {
$text = 'אזל מהמלאי';
}
return $text;
}
if (ICL_LANGUAGE_CODE == "fr") {

    //show the form in French

} elseif (ICL_LANGUAGE_CODE == "de") {

    //show the form in German

} else {

    //show the default form in English

}
/*
 * Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
 */
function rd_duplicate_post_as_draft(){
  global $wpdb;
  if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
    wp_die('No post to duplicate has been supplied!');
  }
 
  /*
   * Nonce verification
   */
  if ( !isset( $GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE_ ) ) )
    return;
 
  /*
   * get the original post id
   */
  $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
  /*
   * and all the original post data then
   */
  $post = get_post( $post_id );
 
  /*
   * if you don't want current user to be the new post author,
   * then change next couple of lines to this: $new_post_author = $post->post_author;
   */
  $current_user = wp_get_current_user();
  $new_post_author = $current_user->ID;
 
  /*
   * if post data exists, create the post duplicate
   */
  if (isset( $post ) && $post != null) {
 
    /*
     * new post data array
     */
    $args = array(
      'comment_status' => $post->comment_status,
      'ping_status'    => $post->ping_status,
      'post_author'    => $new_post_author,
      'post_content'   => $post->post_content,
      'post_excerpt'   => $post->post_excerpt,
      'post_name'      => $post->post_name,
      'post_parent'    => $post->post_parent,
      'post_password'  => $post->post_password,
      'post_status'    => 'draft',
      'post_title'     => $post->post_title,
      'post_type'      => $post->post_type,
      'to_ping'        => $post->to_ping,
      'menu_order'     => $post->menu_order
    );
 
    /*
     * insert the post by wp_insert_post() function
     */
    $new_post_id = wp_insert_post( $args );
 
    /*
     * get all current post terms ad set them to the new post draft
     */
    $taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
    foreach ($taxonomies as $taxonomy) {
      $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
      wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
    }
 
    /*
     * duplicate all post meta just in two SQL queries
     */
    $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
    if (count($post_meta_infos)!=0) {
      $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
      foreach ($post_meta_infos as $meta_info) {
        $meta_key = $meta_info->meta_key;
        if( $meta_key == '_wp_old_slug' ) continue;
        $meta_value = addslashes($meta_info->meta_value);
        $sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
      }
      $sql_query.= implode(" UNION ALL ", $sql_query_sel);
      $wpdb->query($sql_query);
    }
 
 
    /*
     * finally, redirect to the edit post screen for the new draft
     */
    wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    exit;
  } else {
    wp_die('Post creation failed, could not find original post: ' . $post_id);
  }
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to action list for post_row_actions
 */
function rd_duplicate_post_link( $actions, $post ) {
  if (current_user_can('edit_posts')) {
    $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(_FILE_), 'duplicate_nonce' ) . '" title="שכפל דף/פוסט זה" rel="permalink">שכפל דף/פוסט</a>';
  }
  return $actions;
}
 
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );

add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);
add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;
    
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url());
        exit;
    }

    // Remove comments metabox from dashboard
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');

    // Disable support for comments and trackbacks in post types
    foreach (get_post_types() as $post_type) {
        if (post_type_supports($post_type, 'comments')) {
            remove_post_type_support($post_type, 'comments');
            remove_post_type_support($post_type, 'trackbacks');
        }
    }
});
<script>

jQuery("input , textarea").focus(function(){
  jQuery(this).parents('.elementor-field-group').addClass('focused');
});

jQuery("input , textarea").blur(function(){
  var inputValue = jQuery(this).val();
  if ( inputValue == "" ) {
    jQuery(this).parents('.elementor-field-group').removeClass('focused');  
  }
});
</script>

ואת הקוד הזה בתוך CSS מותאם של הטופס:


selector .elementor-field-group {
  position: relative;
}
selector .elementor-field-label {
  position: absolute;
  left: 15px;
  top: 10px;
  color: #999;
  z-index: 10;
  transition: font-size 150ms ease-out, -webkit-transform 150ms ease-out;
  transition: transform 150ms ease-out, font-size 150ms ease-out;
  transition: transform 150ms ease-out, font-size 150ms ease-out, -webkit-transform 150ms ease-out;
}

selector .focused .elementor-field-label {
    background-color: #fff;
    line-height:1.5;
  -webkit-transform: translateY(-100%);
          transform: translateY(-100%);
  font-size: .90em;
}
.woocommerce-product-gallery__trigger {
    left: unset;
    right: .5em;
}

.woocommerce-product-gallery.woocommerce-product-gallery--with-images.images {
    display: flex;
}

.woocommerce div.product div.images .flex-control-thumbs li {
    width: 100%!important;
}
<script type="text/javascript" charset="utf-8" src="https://www.hebcal.com/etc/hdate-he.js"></script>
<script language="JavaScript">
<!--
var today = new Date ( );

var days = new Array ( );
days[days.length] = "יום ראשון";
days[days.length] = "יום שני";
days[days.length] = "יום שלישי";
days[days.length] = "יום רביעי";
days[days.length] = "יום חמישי";
days[days.length] = "יום שישי";
days[days.length] = "יום שבת";

var months = new Array ( );
months[months.length] = "ינואר";
months[months.length] = "פברואר";
months[months.length] = "מרץ";
months[months.length] = "אפריל";
months[months.length] = "מאי";
months[months.length] = "יוני";
months[months.length] = "יולי";
months[months.length] = "אוגוסט";
months[months.length] = "ספטמבר";
months[months.length] = "אוקטובר";
months[months.length] = "נובמבר";
months[months.length] = "דצמבר";

document.write ( days[today.getDay()] );
document.write ( ", " );
document.write ( " " + today.getDate() );
document.write ( " ל" );
document.write ( months[today.getMonth()] );
document.write ( " שנת " );
document.write ( " " + today.getFullYear() );
// -->
</script>
/* Create Buy Now Button dynamically after Add To Cart button */

    function add_content_after_addtocart() {

    

        // get the current post/product ID

        $current_product_id = get_the_ID();

    

        // get the product based on the ID

        $product = wc_get_product( $current_product_id );

    

        // get the "Checkout Page" URL

        $checkout_url = WC()->cart->get_checkout_url();

    

        // run only on simple products

        if( $product->is_type( 'simple' ) ){

            echo '<a href="'.$checkout_url.'?add-to-cart='.$current_product_id.'" class="buy-now button">Buy Now</a>';

            //echo '<a href="'.$checkout_url.'" class="buy-now button">Buy Now</a>';

        }

    }

    add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );
function wc_discount_total() {
   global $woocommerce;
    $discount_total = 0;
      
    foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {
          
    $_product = $values['data'];
  
        if ( $_product->is_on_sale() ) {
        $regular_price = $_product->get_regular_price();
        $sale_price = $_product->get_sale_price();
        $discount = ($regular_price - $sale_price) * $values['quantity'];
        $discount_total += $discount;
        }
    }        
    if ( $discount_total > 0 ) {
    echo '<tr class="cart-discount">
    <th>'. __( 'Your Savings', 'woocommerce' ) .'</th>
    <td data-title=" '. __( 'You Saved', 'woocommerce' ) .' ">'
    . wc_price( $discount_total + $woocommerce->cart->discount_cart ) .'</td>
    </tr>';
    }
}
add_action( 'woocommerce_cart_totals_after_order_total', 'wc_discount_total', 99);
add_action( 'woocommerce_review_order_after_order_total', 'wc_discount_total', 99);
// Add Character Counter to the Excerpt Meta Box
function excerpt_count_js(){
    if ('page' != get_post_type()) { ?>
        <script>

        (function($){

            $(document).ready(function(){

                if ( $('#postexcerpt').length ) {

                    var maxChar = 128;

                    $excerpt = $('#excerpt');

                    $("#postexcerpt .handlediv").after( '<div style="position:absolute;top:5px;right:80px;color:#666;">' +
                                                            '<small>Excerpt length: </small>' +
                                                            '<input type="text" value="0" maxlength="3" size="3" id="excerpt_counter" readonly="" style="background:#fff;" /> ' +
                                                            '<small>character(s). (' + maxChar + ' Characters MAX)</small>' +
                                                        '</div>'
                                                    );

                    $excerptCounter = $("#excerpt_counter");

                    $excerptCounter.val( $excerpt.val().length );

                    $excerpt.keyup( function() {

                        $excerptCounter.val( $excerpt.val().length );

                        var exColor = ( ( $excerptCounter.val() > maxChar ) ? 'red' : 'green' );

                        $excerptCounter.css( 'color', exColor );

                    });

                }

            });

         })(jQuery);

        </script>
    <?php }
}
add_action( 'admin_head-post.php', 'excerpt_count_js');
add_action( 'admin_head-post-new.php', 'excerpt_count_js');
// add clear cache option to shop owner
function wp_rocket_add_purge_cache_to_shop_owner() {
	// gets the shop owner role object
	$role = get_role('shop_manager');
 
	// add a new capability
	$role->add_cap('rocket_purge_cache', true);
}
add_action('init', 'wp_rocket_add_purge_cache_to_shop_owner', 12);
press F12 in your Browser then choose console and paste the below code there and press enter:

var all = document.getElementsByTagName("*"), i = 0, rect, docWidth = document.documentElement.offsetWidth; for (; i < all.length; i++) { rect = all[i].getBoundingClientRect(); if (rect.right > docWidth || rect.left < 0){ console.log(all[i]); all[i].style.borderTop = '1px solid red'; } }
javascript🙁function(debug){var w=debug.documentElement.offsetWidth,t=debug.createTreeWalker(debug.body,NodeFilter.SHOW_ELEMENT),b;while(t.nextNode()){b=t.currentNode.getBoundingClientRect();if(b.right>w||b.left<0){t.currentNode.style.setProperty('outline','1px dotted red','important');console.log(t.currentNode);}};}(document));
/* Clear cart data before adding new */ // before addto cart, only allow 1 item in a cart
 add_filter( 'woocommerce_add_to_cart_validation', 'woo_custom_add_to_cart_before' ); function woo_custom_add_to_cart_before( $cart_item_data ) { global $woocommerce; $woocommerce->cart->empty_cart(); // Do nothing with the data and return return true; }
input[type="date"]:before{
color:rgba(53, 53, 53, 0.44);
content:attr(placeholder);
}
input[type="date"].full:before {
color:black;
content:""!important;
}
input[type="time"]:before{
color:rgba(53, 53, 53, 0.44);
content:attr(placeholder);
}
input[type="time"].full:before {
color:black;
content:""!important;
}
<script>
jQuery(document).ready( () => {

function getUrlParameter(name, url) {
    if (!url) {
        url = window.location.href;
    }
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(url);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
var coach = getUrlParameter('coachvar');


jQuery("[name='coach_field'").val(coach);
});

</script>
<?php 
/* --- GIFT WRAP FIELDS CHECKOUT AND ADMIN --- */

/**
* Add the fields to the checkout
*/

add_action( 'woocommerce_after_checkout_billing_form', 'my_custom_checkout_field' );

function my_custom_checkout_field( $checkout ) {
   echo '<div class="my_gift_wrap_checkout_field"><h2>' . __('Gift wrap', 'woocommerce') .'</h2>';
   
   woocommerce_form_field( 'my_gift_wrap_checkbox', array(
'type'          => 'checkbox',
'class'         => array('checkbox_field'),
'label'         => __('Free gift wrapping? - Yes please!', 'woocommerce'),
'required'  => false,
), $checkout->get_value( 'my_gift_wrap_checkbox' ));

woocommerce_form_field( 'my_gift_wrap_field', array(

'type' => 'textarea',
   'label'      => __('Gift wrap instructions', 'woocommerce'),
   'placeholder'   => _x('Please enter any gift wrapping instructions. For example if you have multiple items in your order but only want 1 wrapped, or a special message to include.', 'placeholder', 'woocommerce'),
   'required'   => false,
   'class'      => array('form-row-wide'),
   'clear'     => true,
       ), $checkout->get_value( 'my_gift_wrap_field' ));

   echo '</div>';
}

/**
* Update the order meta with fields values
*/

add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );

function my_custom_checkout_field_update_order_meta( $order_id ) {

      if ( ! empty( $_POST['my_gift_wrap_checkbox'] ) ) {
       update_post_meta( $order_id, 'my_gift_wrap_checkbox', $_POST['my_gift_wrap_checkbox'] );
   }
      if ( ! empty( $_POST['my_gift_wrap_field'] ) ) {
       update_post_meta( $order_id, 'my_gift_wrap_field', $_POST['my_gift_wrap_field'] );
   }
}

/**
* Display fields on the order edit page
*/

add_action('woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );

function my_custom_checkout_field_display_admin_order_meta($order){

  if (get_post_meta( $order->id, 'my_gift_wrap_checkbox', true ) == 1){
	  echo '<p><strong>'.__('Gift wrap', 'woocommerce').': </strong> ' . __('Yes please!', 'woocommerce'). '</p>';
  } else {
	  echo '<p><strong>'.__('Gift wrap', 'woocommerce').': </strong> ' . __('No thank you', 'woocommerce'). '</p>';
  }
  echo '<p><strong>'.__('Gift wrap instructions', 'woocommerce').': </strong> ' . get_post_meta( $order->id, 'my_gift_wrap_field', true ) . '</p>';
}

/**
 * Add the fields to order emails and thank you page.
 **/
add_action( "woocommerce_email_after_order_table", "my_woocommerce_email_after_order_table", 10, 1);

/* add same function to run on after orders table for thank you page */
add_action( 'woocommerce_order_details_after_order_table', "my_woocommerce_email_after_order_table", 10, 1 );

function my_woocommerce_email_after_order_table( $order ) {
    $my_gift_wrap_checkbox = get_post_meta( $order->id, "my_gift_wrap_checkbox", true );
    $gift_wrap = $my_gift_wrap_checkbox ? __('Yes please!', 'woocommerce') : __('No thank you.', 'woocommerce');

    echo '<p><strong>Gift wrap?: </strong>' . $gift_wrap . '</p>';

    if ( $my_gift_wrap_checkbox ) {
        echo '<p><strong>Gift wrap instructions: </strong>' . get_post_meta( $order->id, "my_gift_wrap_field", true ) . '</p>';
    }

}
?>
add_filter( 'woocommerce_sale_flash', 'navarro_change_badge_to_percentage', 99, 3 );

function navarro_change_badge_to_percentage( $html, $post, $product ) {

	$price = intval( ( $product instanceof WC_Product_Variable ) ? $product->get_variation_regular_price() : $product->get_regular_price() );

	$sale = intval( ( $product instanceof WC_Product_Variable ) ? $product->get_variation_sale_price() : $product->get_sale_price() );

	$discunt = $price - $sale;

	return sprintf( '<div class="onsale-wrapper"><span class="onsale"> %s₪ %s</span></div>', $discunt, __( 'הנחה', 'woocommerce' ) );
}
באזור: 
selector .elementor-container .elementor-row {
    flex-wrap: wrap;
}

בכל עמודה:
selector {
    width: 100%;
}

@media (max-width: 767px) {
    selector {
        width: 100%!important;
    }
}
function cw_custom_checkbox_fields( $checkout ) {
        echo '<div class="cw_custom_class"><h3>'.__('אני מאשר/ת את תקנון האתר/חנות: ').'</h3>';
        woocommerce_form_field( 'custom_checkbox', array(
            'type'          => 'checkbox',
            'label'         => __('אני מאשר/ת את תקנון האתר/חנות'),
            'required'  => true,
        ), $checkout->get_value( 'custom_checkbox' ));
        echo '</div>';
    }
add_action('admin_footer','posts_status_color');
function posts_status_color(){
?>
<style>
.status-draft{background: #FCE3F2 !important;}
.status-pending{background: #87C5D6 !important;}
.status-publish{/* no background keep wp alternating colors */}
.status-future{background: #C6EBF5 !important;}
.status-private{background:#F2D46F;}
</style>
<?php
}
/*שינוי צבע אדמין לכולם*/
add_filter( 'get_user_option_admin_color', 'update_user_option_admin_color', 5 );

function update_user_option_admin_color( $color_scheme ) {
    $color_scheme = 'blue';

    return $color_scheme;
}
לעמודה
.sticky-column{
position: sticky;
position: -webkit-sticky;
top: 3rem;
}
להורה שלה
.sticky-parent
.elementor-widget-wrap {
display: block!important; 
}
/*@media only screen and (max-width: 768px) {
    selector h2:before{
        font-size:120%!important;
    }
}

selector h2:before{
    content:'4. התקנת המערכת';
    position: absolute;
    top: -50%;
    right: -5%;
    font-size: 150%;
    color: var(--e-global-color-accent);
    z-index: -1;
    opacity: .2;
}
// Add this to Quary in elementor: order_by_posts_views
function getPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0 View";
    }
    return $count.' צפיות';
}
function setPostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
}
 
// Remove issues with prefetching adding extra views
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); 
// Add to a column in WP-Admin
add_filter('manage_posts_columns', 'posts_column_views');
add_action('manage_posts_custom_column', 'posts_custom_column_views',5,2);
function posts_column_views($defaults){
    $defaults['post_views'] = __('צפיות');
    return $defaults;
}
function posts_custom_column_views($column_name, $id){
    if($column_name === 'post_views'){
        echo getPostViews(get_the_ID());
    }
}
add_action('wp_head', function() { if ( is_single() ) { setPostViews(get_the_ID()); } });
add_action( 'elementor/query/order_by_posts_views', function( $query ) {
    $query->set( 'meta_key', 'post_views_count' );
    $query->set( 'orderby', 'meta_value_num' );
    $query->set( 'order', 'DESC' );
} );
=IF(LEFT(TRIM(G2),1)="+","0"&MID(G2,5,10),(IF(LEFT(TRIM(G2),1)<>"0",IF(LEFT(TRIM(G2),3)="972","0"&MID(G2,4,10),"0"&G2),G2)))
add_shortcode('user_role', function() {
  global $wp_roles;
  if( is_user_logged_in() ) {
    $user = wp_get_current_user();
    $roles = ( array ) $user->roles;
    echo '<span>';
    foreach( $roles as $role ){
      echo  $wp_roles->roles[ $role ]['name'] ;
    }
  }
});
<script>
jQuery( "#btn1" ).click(function() {
   jQuery('.first').css("display","block");
   jQuery('.second').css("display","none");

   jQuery('#btn2').removeClass("btn_active");
   jQuery('#btn1').addClass("btn_active");
 
});

jQuery( "#btn2" ).click(function() {
   jQuery('.second').css("display","block");
   jQuery('.first').css("display","none");
   
   jQuery('#btn1').removeClass("btn_active");
   jQuery('#btn2').addClass("btn_active");
});
</script>
<script>
jQuery(function($){
$(document).on('click','.elementor-location-popup a', function(event){
elementorProFrontend.modules.popup.closePopup( {}, event);
});
});
</script>
function cw_custom_checkbox_fields( $checkout ) {
        echo '<div class="cw_custom_class"><h3>'.__('אישור דיוור: ').'</h3>';
        woocommerce_form_field( 'custom_checkbox', array(
            'type'          => 'checkbox',
            'label'         => __('אני מאשר\ת את הדיוור.'),
            'required'  => false,
        ), $checkout->get_value( 'custom_checkbox' ));
        echo '</div>';
    }
dd_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
/* * custom_woocommerce_template_loop_add_to_cart**/
function custom_woocommerce_product_add_to_cart_text() {	
global $product;		
  $product_type = $product->get_type();		switch ( $product_type ) {		case 'external':			return _( 'Buy product', 'woocommerce' );		break;		case 'grouped':			return _( 'View products', 'woocommerce' );		break;		case 'simple':			return _( 'Add to cart', 'woocommerce' );		break;		case 'variable':			return _( 'Select options', 'woocommerce' );		break;		default:			return __( 'Read more', 'woocommerce' );	}	}
/* Create Buy Now Button dynamically after Add To Cart button
    function add_content_after_addtocart() {
    
        // get the current post/product ID
        $current_product_id = get_the_ID();
    
        // get the product based on the ID
        $product = wc_get_product( $current_product_id );
    
        // get the "Checkout Page" URL
        $checkout_url = WC()->cart->get_checkout_url();
    
        // run only on simple products
        if( $product->is_type( 'simple' ) ){
            echo '<a href="'.$checkout_url.'?add-to-cart='.$current_product_id.'" class="buy-now button" style="background-color: #000000 !important; margin-right: 10px;">קנה עכשיו</a>';
            //echo '<a href="'.$checkout_url.'" class="buy-now button">קנה עכשיו</a>';
        }
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );

 

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *