Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mayco Barale maycomayco

🎯
Focusing
  • Córdoba - Argentina
View GitHub Profile
@maycomayco
maycomayco / dequeue_woocommerce.php
Created Jul 26, 2018
Script que permite eliminar las dependencias de WooCommerce en todas las páginas que no están relacionadas con su funcionamiento; todas salvo el carrito, checkout y las propias paginaciones de WooCommerce.
View dequeue_woocommerce.php
function bf_dequeue_woocommerce_styles_scripts() {
if( function_exists( 'is_woocommerce' ) ) {
if( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
# Styles
wp_dequeue_style( 'woocommerce-general' );
wp_dequeue_style( 'woocommerce-layout' );
wp_dequeue_style( 'woocommerce-smallscreen' );
wp_dequeue_style( 'woocommerce_frontend_styles' );
wp_dequeue_style( 'woocommerce_fancybox_styles' );
wp_dequeue_style( 'woocommerce_chosen_styles' );
@maycomayco
maycomayco / 5-columns.css
Created Jul 18, 2018
VC 5 columns layout
View 5-columns.css
/*
* Set in row parent "five-columns" class
*/
@media screen and (min-width: 768px) {
.five-columns.vc_row .vc_col-sm-2 {
float: left;
width: 18.5%;
padding: 0;
margin-right: 1.5%;
min-height: 0;
@maycomayco
maycomayco / clickable-div.html
Last active Jul 4, 2018
Helper que permite hacer linkeable un <div> a la URL que tiene seteada el primer elemento <a> dentro de él.
View clickable-div.html
<div class="box">
<h2>Box Title</h2>
<p>The Quick Brown Fox Jumped Over The Lazy Dog</p>
<p><a class="divLink" href="http://www.labnol.org/">Webpage URL</a></p>
</div>
<script>
jQuery(document).ready(function () {
// Or use this to Open link in same window (similar to target=_blank)
jQuery(".box").click(function(){
window.location = jQuery(this).find("a:first").attr("href");
@maycomayco
maycomayco / delete_empty_sku.sql
Created Apr 10, 2018
Delete empty Woocommerce SKU
View delete_empty_sku.sql
DELETE wp_posts,
wp_postmeta,
wp_comments,
wp_commentmeta
FROM wp_posts
LEFT JOIN wp_postmeta
ON wp_postmeta.post_id = wp_posts.ID
AND wp_postmeta.meta_key = '_sku'
@maycomayco
maycomayco / empty_sku.sql
Created Apr 10, 2018
Find Woocommerce product whit empty SKU
View empty_sku.sql
SELECT p.ID,
p.post_title,
p.post_type,
pm.meta_value
FROM wp_posts p
LEFT JOIN wp_postmeta pm
ON pm.post_id = p.ID
AND pm.meta_key = '_sku'
View functions.php
add_filter( 'body_class', 'knx_body_class_for_pages' );
/**
* Adds a css class to the body element
*
* @param array $classes the current body classes
* @return array $classes modified classes
*/
function knx_body_class_for_pages( $classes ) {
global $post;
$classes[] = $post->post_name;
@maycomayco
maycomayco / wp-woocommerce-shortcodes.php
Created Jan 3, 2018
Conjunto de funciones básicas para la edición de Woocommerce
View wp-woocommerce-shortcodes.php
/*
* https://businessbloomer.com/category/woocommerce-tips/visual-hook-series/
*/
//remover resultado de pagina shop
remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_result_count', 20 );
//remover orden de catalogo pagina shop
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);