Skip to content

Instantly share code, notes, and snippets.

@titodevera
titodevera / functions.php
Created December 27, 2021 19:30
Display WooCommerce product variations dropdown select on the shop, categories, catalog... pages
<?php
/**
* Display WooCommerce product variations dropdown select on the shop, categories, catalog... pages
* Tested on WordPress 5.8.2 + WooCommerce 5.9.0 + Storefront 3.9.1 + PHP 7.3.11
*
* Alberto de Vera Sevilla <hola@albertodevera.es>
*/
add_filter( 'woocommerce_loop_add_to_cart_link', function( $html, $product ) {
if ( $product->is_type( 'variable' ) ) {
@mitchellkrogza
mitchellkrogza / inline flatsome.css (NEW with inline icons) - Flatsome 3.14 Only
Created July 19, 2021 12:56
Inline flatsome.css (Flatsome Theme 3.14+ only)
add_action('wp_head', 'inject_flatsome', 5);
function inject_flatsome() {
ob_start();
include 'wp-content/themes/flatsome/assets/css/flatsome.css';
$atf_css = ob_get_clean();
if ($atf_css != "" ) {
$theme = wp_get_theme( get_template() );
$version = $theme->get( 'Version' );
$fonts_url = get_template_directory_uri() . '/assets/css/icons';
$atf_css .= '@font-face {
@mitchellkrogza
mitchellkrogza / delete-woocommerce-product-images
Created June 10, 2021 12:35
Delete Woocommerce Product images when deleting a Product
add_action( 'before_delete_post', 'delete_product_images', 10, 1 );
function delete_product_images( $post_id )
{
$product = wc_get_product( $post_id );
if ( !$product ) {
return;
}
@yanknudtskov
yanknudtskov / woo-orders-by-product-name.sql
Created February 18, 2021 21:42
Get WooCommerce Completed Orders by Product Name
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,
@LucasGorgal
LucasGorgal / .md
Last active March 8, 2021 13:37
Usando POST do Instagram
@pedrouid
pedrouid / setup-ssl.md
Last active April 29, 2024 21:39
Setup SSL with NGINX reverse proxy

Get a Free SSL Certificate With Let’s Encrypt

Let’s Encrypt is a free, automated, and open Certificate Authority.

  1. Install tools for using the Let's Encrypt certificates using Certbot
  sudo apt-get update \
  sudo apt-get install software-properties-common
<?php
// Going from 'pa_size' to 'Size' the hard way.
if ( 0 === strpos( $args[ 'attribute' ], 'pa_' ) ) {
$args['show_option_none'] = 'Choose ' . ucwords( str_replace( '-', ' ', substr( $args[ 'attribute' ], 3 ) ) );
}
@willguesser
willguesser / cornerRibon.css
Created March 4, 2018 06:49
Pure CSS corner ribbon - Fita lateral de canto em CSS puro.
@import url(https://fonts.googleapis.com/css?family=Lato:700);
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #f0f0f0;
}
.box {
position: relative;
@HenriqueSilverio
HenriqueSilverio / estados-cidades.json
Last active January 9, 2019 05:17 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",