Skip to content

Instantly share code, notes, and snippets.

View marlonamancio's full-sized avatar

Marlon Amâncio marlonamancio

View GitHub Profile
@aslamdoctor
aslamdoctor / woocommerce-delete-failed-orders.sql
Last active July 4, 2024 22:10
WooCommerce : Delete all failed orders
-- Below queries are just to check the failed order records:
SELECT * FROM `wp_woocommerce_order_itemmeta` WHERE order_item_id IN (SELECT order_item_id FROM `wp_woocommerce_order_items` WHERE order_id IN (SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND post_status='wc-failed'))
SELECT * FROM `wp_woocommerce_order_items` WHERE order_id IN (SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND post_status='wc-failed')
SELECT * FROM wp_comments WHERE comment_type = 'order_note' AND comment_post_ID IN(SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND post_status='wc-failed')
SELECT * FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' AND post_status='wc-failed')
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active October 12, 2024 17:22
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@ciorici
ciorici / index.php
Created April 27, 2017 08:10
Featured Products Loop in WooCommerce 3.0
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
@yunusga
yunusga / gist:33cf0ba9e311e12df4046722e93d4123
Created April 5, 2017 11:55
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
@thierrypigot
thierrypigot / scripts.js
Last active July 6, 2023 19:26
[Beaver Builder] Highlight menu links on a One Page with anchor links and sections detection on scroll
(function($){
$(document).ready(function(){
/**
* This part handles the highlighting functionality.
* We use the scroll functionality again, some array creation and
* manipulation, class adding and class removing, and conditional testing
*/
var aChildren = $("header ul.menu li").children(); // find the a children of the list items
@claudiosanches
claudiosanches / functions.php
Created July 20, 2016 11:30
WooCommerce - Redirect to checkout after add product to the cart
<?php
/**
* Add to cart redirect to checkout.
*
* @param string $url
* @return string
*/
function my_wc_add_to_cart_redirect_to_checkout( $url ) {
return wc_get_checkout_url();
@mikejolley
mikejolley / query.sql
Created April 26, 2016 09:37
WooCommerce - SQL to Delete users with no orders or posts
DELETE from wp_users where wp_users.ID not in (
SELECT meta_value FROM wp_postmeta WHERE meta_key = '_customer_user'
) AND wp_users.ID not in (
select distinct(post_author) from wp_posts
);
delete from wp_usermeta where wp_usermeta.user_id not in (select ID from wp_users);
<?php
/**
* Filter the terms query SQL clauses.
*
* @see 'terms_clauses' filter in get_terms() wp-includes/taxonomy.php
*
* @since 0.1.0
*
* @todo add filter for $allowed_orderby_keys
@joeguilmette
joeguilmette / Web Development Contract.md
Last active August 4, 2023 09:06
Web Development Contract

Web Design Contract

Based on Contract Killer, an open-source contract for web developers.

Summary:

I’ll always do my best to fulfill your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. I have no desire to trick you into signing something that you might later regret. What I do want is what’s best for both parties, now and in the future.

So in short;

You ([CLIENT COMPANY]), located at [CLIENT ADDRESS] are hiring me ([DEVELOPER]) located at [DEVELOPER ADDRESS] to design and develop a web site for the estimated total price of [QUOTE] as outlined in our previous correspondence.

@jlengstorf
jlengstorf / README.md
Last active January 20, 2022 07:21
Bootstrap styling for Gravity Forms, LESS style.

Bootstrap Styles for Gravity Forms in LESS

Include these styles in any project using Bootstrap (with LESS) and Gravity Forms to add good baseline styles for your GF Forms.