Skip to content

Instantly share code, notes, and snippets.

View miniMAC's full-sized avatar
👾
find bugs...

Christian miniMAC

👾
find bugs...
View GitHub Profile
( function( $ ) {
$(document).ready(function (){
// Live Search
$('#live-search-faux-input').on('click', function() {
$('.live-search-modal').fadeIn(500);
$('input#live-search-input').focus();
$('#live-search-input').addClass('live-search-to-show');
});
$('input#live-search-input').on('input', function() {
@miniMAC
miniMAC / functions.php
Last active December 1, 2021 07:33
Applicare a WooCommerce uno sconto in un certo range di date
<?php
/**
* Applicare uno sconto nel carrello, se siamo el range di 2 date
* (giorno settato compreso)
*/
function applica_sconto_per_range_di_date( $cart ) {
// Se siamo in admin e non è una chiamata AJAX
if ( ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) {
@miniMAC
miniMAC / functions.php
Created December 20, 2018 09:23
Fix WooCommerce orders list bug + WordPress 5.0.2
// FIX WooCommerce orders list bug
function fix_query_args_woo_orders( $query_args ) {
if ( isset( $query_args['post_status'] ) &&
empty( $query_args['post_status'] ) ) {
unset( $query_args['post_status'] );
}
return $query_args;
}
<?php
/**
* YourTheme
*
* @package YourTheme
*
* To include that file: get_template_part('live','search');
*/
?>
<div id="live-search-faux-input"><input type="text" placeholder="<?php _e('Search...','yourtheme') ?>"></div>
<?php
/**
* Live search
*/
function live_search(){
$the_query = new WP_Query( [
'post_type' => ['posts'],
'posts_per_page' => -1,
's' => esc_attr($_POST['keyword'])
<?php
function live_search_scripts() {
wp_register_script( 'live-search', get_template_directory_uri() . '/scripts.js', array('jquery'), null, true );
wp_enqueue_script( 'live-search' );
$live_search = [
'ajax_url' => admin_url('admin-ajax.php')
];
@miniMAC
miniMAC / style.css
Last active September 12, 2017 07:08
@font-face {
font-family: 'Roboto';
src: url('Roboto-Bold.eot');
src: url('Roboto-Bold.eot?#iefix') format('embedded-opentype'),
url('Roboto-Bold.woff') format('woff'),
url('Roboto-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
/* Live Search */
.live-search-modal {
position: fixed;
z-index: 998;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;

sudo nano npm install gulp

npm install gulp