This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( 'body' ).on( 'click', '.my_ajax_btn', function(e){ | |
e.preventDefault(); | |
var first_name = 'Guy'; | |
var last_name = 'Ytzhak'; | |
var role = 'CEO'; | |
jQuery.ajax({ | |
url: sp_ajaxify.ajax_url, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_ajax_wordpress_ajax_action_name', 'wordpress_ajax_action_name' ); | |
add_action( 'wp_ajax_nopriv_wordpress_ajax_action_name', 'wordpress_ajax_action_name' ); | |
function wordpress_ajax_action_name(){ | |
echo 'test :)'; | |
wp_die(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woocommerce_add_to_cart_variable_rc_callback() { | |
ob_start(); | |
$product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) ); | |
$quantity = empty( $_POST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', $_POST['quantity'] ); | |
$variation_id = $_POST['variation_id']; | |
$variation = $_POST['variation']; | |
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Save current single product to cookies | |
* To display those products in single product 'Recentrly searched' section | |
*/ | |
add_action('wp', 'matat_save_current_single_product_to_cookies'); | |
function matat_save_current_single_product_to_cookies() { | |
if( get_field('recently_viewed_cookie_num', 'options') ) { | |
$number_of_products = get_field('recently_viewed_cookie_num', 'options'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
add_action('acf/init', 'ofert_acf_add_local_field_groups'); | |
function ofert_acf_add_local_field_groups() { | |
//$screen = get_current_screen(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Auto_Placeholder_Images | |
* @version 1.0.0 | |
*/ | |
/* | |
Plugin Name: Auto Placeholder For Broken Images | |
Plugin URI: https://www.webstorm.co.il/css-live-reload/ | |
Description: **FOR DEV USE ONLY** This plugin resolve broken layout when we work on local machine without all uploaded images up to date. Will replace the images with image placeholder via placeholder.com | |
Author: Moshe Harush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removes the WooCommerce filter, that is validating the quantity to be an int | |
remove_filter('woocommerce_stock_amount', 'intval'); | |
// Add a filter, that validates the quantity to be a float | |
add_filter('woocommerce_stock_amount', 'floatval'); | |
add_filter( 'woocommerce_quantity_input_step', 'mz_woocommerce_quantity_input_step', 99, 2 ); | |
function mz_woocommerce_quantity_input_step($step, $product) { | |
// change the "step" based on $product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'pre_get_posts','mz_search_posts_per_page' ); | |
// Alter search posts per page | |
function mz_search_posts_per_page($query) { | |
if ( $query->is_search ) { | |
$query->set( 'posts_per_page', '-1' ); | |
$query->set( 'post_type', 'product' ); | |
} | |
return $query; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').on('change keyup input', '.quantity_mini input', function () { | |
var qtyMiniWrapper = $(this).closest('.quantity_mini'), | |
qtyMiniUpdateBtn = qtyMiniWrapper.find('button.update'), | |
defaultQty = parseFloat(qtyMiniUpdateBtn.attr('data-default_qty')), | |
selectedQty = parseFloat($(this).val()); | |
if( defaultQty !== selectedQty ) { | |
qtyMiniUpdateBtn.fadeIn('350'); | |
} else { | |
qtyMiniUpdateBtn.fadeOut('350'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').on('submit', '.product form', function (e) { | |
e.preventDefault(); | |
var productVariationID = $(this).find('.variations').length > 0 ? $(this).find('.variation_id').val() : null, | |
productID = $(this).find('[name="add-to-cart"]').val(), | |
productQty = $(this).find('input.qty').val(), | |
variationArray = {}, | |
productElm = $(this).closest('.product'); | |
OlderNewer