Skip to content

Instantly share code, notes, and snippets.

View mrfoxtalbot's full-sized avatar
🥐

Alvaro Gómez Velasco mrfoxtalbot

🥐
View GitHub Profile
@mrfoxtalbot
mrfoxtalbot / qtranslate.php
Created October 25, 2017 13:19 — forked from barbwiredmedia/qtranslate.php
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 } ?>
<?php
/**
* For developers: WordPress debugging mode.
*
* If the default WP_DEBUG function is set to false and
* there are still warnings or errors showing up, try
* using the following instead
*/
ini_set('log_errors','On');
ini_set('display_errors','Off');
@mrfoxtalbot
mrfoxtalbot / css-selectors.md
Created May 21, 2017 14:50 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
<?php
/*
Plugin Name: Lightweght Share para Tu Experto
Description: Botones de compartir ligeritos y sin javascript.
Version: 0.3
Author: Mr.FoxTalbot
Author URI: http://mrfoxtalbot.com
License: GPL2
*/
function tuexperto_social() {
@mrfoxtalbot
mrfoxtalbot / redirect-attachments-to-parnt-post.php
Last active September 30, 2016 17:34 — forked from braddalton/functions.php
Redireccionar adjuntos al post asociado
add_action( 'template_redirect', 'wpsites_attachment_redirect' );
function wpsites_attachment_redirect(){
global $post;
if ( is_attachment() && isset($post->post_parent) && is_numeric($post->post_parent) && ($post->post_parent != 0) ) :
wp_redirect( get_permalink( $post->post_parent ), 301 );
exit();
wp_reset_postdata();
endif;
}
@mrfoxtalbot
mrfoxtalbot / gist:87e3aa64cbafb9a34c354e62cc117221
Created August 16, 2016 17:34 — forked from m/gist:bab8d366d2e826ba2311
freedom zero mark pilgrim text
Movable Type has never been Free Software, as defined by the Free Software
Foundation. It has never been open source software, as defined by the Open
Source Initiative. Six Apart survived and thrived in the blogging community
because Movable Type was “free enough.”
Many people misunderstand
Free Software and the GNU General Public License. Many people equate the GPL to
the boogeyman, because it’s “viral”, and that sounds like a bad thing.
@mrfoxtalbot
mrfoxtalbot / site-new.php
Created November 19, 2015 13:54 — forked from igmoweb/site-new.php
Custom query shortcode
<?php
add_shortcode( 'areas', 'custom_query_shortcode' );
function custom_query_shortcode( $atts ) {
// EXAMPLE USAGE:
// [areas show_posts="100" post_type="page" post_parent="246"]
// Defaults
$defaults = array(
"show_posts" => 100,
"post_type" => 'page',
@mrfoxtalbot
mrfoxtalbot / gist:390ab0fae260436549a8
Created October 27, 2015 21:05 — forked from corsonr/gist:9152652
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 );
/**
@mrfoxtalbot
mrfoxtalbot / gist:755c7a3733443de04e45
Last active August 29, 2015 14:26 — forked from mikejolley/gist:11171530
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