Skip to content

Instantly share code, notes, and snippets.

View mrfoxtalbot's full-sized avatar
🕊️

Alvaro Gómez Velasco mrfoxtalbot

🕊️
View GitHub Profile
@corsonr
corsonr / gist:9152652
Last active October 21, 2025 21:26
WooCommerce : add custom fields to product variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 );
/**
@mikejolley
mikejolley / gist:11171530
Last active May 16, 2019 06:42 — forked from woogist/gist:6065863
Hide all/some shipping options when free shipping is available
/**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped
@snarf1974
snarf1974 / gist:11198020
Created April 22, 2014 23:36
HTML Template: Client-side redirect (meta refresh)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;URL=../new-page.htm" />
<title>Redirect to... title of new-page</title>
</head>
<body>
<h1>Re-directing...</h1>
<p>You are being re-directed, if nothing happens, please <a href="../new-page.htm">follow this link</a></p>
@barbwiredmedia
barbwiredmedia / qtranslate.php
Created May 1, 2014 21:10
Wordpress qTranslate plugin conditional for in the template. For in navigation menus use <!--:en-->Home<!--:--><!--:es-->Inicio<!--:--> as a switch
<?php if (qtrans_getLanguage() == 'en') { ?>
<!-- stuff for English -->
<?php } elseif (qtrans_getLanguage() == 'es') { ?>
<!-- other stuff Spanish -->
<?php } ?>
UPDATE `wp_posts` SET `post_type` = 'photos' WHERE `post_type` = 'members';
@ronalfy
ronalfy / slash_edit_override_endpoint
Last active March 12, 2016 14:40
Override Endpoint for Slash Edit WordPress Plugin
add_filter( 'slash_edit_endpoint', 'rjh_slash_edit_endpoint' );
function rjh_slash_edit_endpoint( $endpoint ) {
return 'edición'; //ends up as edicion since accents are removed
}
@magicznyleszek
magicznyleszek / css-selectors.md
Last active May 7, 2026 15:04
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
@danielpataki
danielpataki / enqueue-register.php
Last active February 19, 2018 20:45
WordPress Enqueues
function my_assets() {
wp_register_script( 'owl-carousel', get_stylesheet_directory_uri() . '/owl.carousel.js', array( 'jquery' ) );
wp_enqueue_script( 'owl-carousel' );
}
add_action( 'wp_enqueue_scripts', 'my_assets' );
@colintoh
colintoh / douchebag-vertical-align.css
Created October 27, 2014 07:08
douchebag way of vertical alignment
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@wpexplorer
wpexplorer / gist:31bdbaeb8fc48f3d4b0c
Last active November 20, 2015 13:22
custom font
// Add custom font to font settings
function wpex_add_custom_fonts() {
return array( 'My Custom Font' ); // You can add more then 1 font to the array!
}