Skip to content

Instantly share code, notes, and snippets.

View maycomayco's full-sized avatar
🎯
Focusing

Mayco Barale maycomayco

🎯
Focusing
  • Córdoba - Argentina
View GitHub Profile
@maycomayco
maycomayco / dequeue_woocommerce.php
Created July 26, 2018 11:35
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.
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 July 18, 2018 11:53
VC 5 columns layout
/*
* 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 July 4, 2018 13:07
Helper que permite hacer linkeable un <div> a la URL que tiene seteada el primer elemento <a> dentro de él.
<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 April 10, 2018 19:20
Delete empty Woocommerce SKU
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 April 10, 2018 19:19
Find Woocommerce product whit empty SKU
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'
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 January 3, 2018 11:24
Conjunto de funciones básicas para la edición de Woocommerce
/*
* 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);