Skip to content

Instantly share code, notes, and snippets.

View jmlamelareal's full-sized avatar

José María Lamela Real jmlamelareal

View GitHub Profile
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jmlamelareal
jmlamelareal / 1.php
Created December 4, 2020 09:48 — forked from Shelob9/1.php
These are step by step examples for converting a WordPress shortcode to a Gutenberg block. Read the tutorial here: https://calderaforms.com/2019/01/convert-shortcode-gutenberg-block/ Completed example here: https://github.com/caldera-learn/basic-blocks/tree/master/blocks/post-title
<?php
/**
* Handler for [cl_post_title] shortcode
*
* @param $atts
*
* @return string
*/
function caldera_learn_basic_blocks_post_title_shortcode_handler($atts)
{
@jmlamelareal
jmlamelareal / webpack.config.js
Last active October 12, 2020 10:17
Wordpress + Webpack + SASS + Custom Fonts
const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
const TerserJSPlugin = require("terser-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const isProduction = process.env.NODE_ENV === "production";
module.exports = {
mode: process.env.NODE_ENV,
entry: {
@jmlamelareal
jmlamelareal / delete-all-woocommerce-products.php
Created March 25, 2020 10:03 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");