Skip to content

Instantly share code, notes, and snippets.

Avatar
👾
find bugs...

Christian miniMAC

👾
find bugs...
View GitHub Profile
@miniMAC
miniMAC / functions.php
Created Dec 20, 2018
Fix WooCommerce orders list bug + WordPress 5.0.2
View functions.php
// 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;
}
View style.css
@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;
}
View functions.php
<?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')
];
View style.css
/* Live Search */
.live-search-modal {
position: fixed;
z-index: 998;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
View scripts.js
( 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() {
View functions.php
<?php
/**
* Live search
*/
function live_search(){
$the_query = new WP_Query( [
'post_type' => ['posts'],
'posts_per_page' => -1,
's' => esc_attr($_POST['keyword'])
View live-search.php
<?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>
View gulp.md

sudo nano npm install gulp

You can’t perform that action at this time.