Skip to content

Instantly share code, notes, and snippets.

View mrfoxtalbot's full-sized avatar
🥐

Alvaro Gómez Velasco mrfoxtalbot

🥐
View GitHub Profile
@stuartduff
stuartduff / wc-exclude-product-category-from-shop-page.php
Last active May 6, 2022 00:20
This snippet will exclude all products from any categories which you choose from displaying on the WooCommerce Shop page.
function custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'clothing' ), // Don't display products in the clothing category on the shop page.
'operator' => 'NOT IN'
);
<?php
/*
Plugin Name: Lightweght Share para Tu Experto
Description: Botones de compartir ligeritos y sin javascript.
Version: 0.1
Author: Mr.FoxTalbot
Author URI: http://mrfoxtalbot.com
License: GPL2
*/
@kontikidigital
kontikidigital / htaccess-redsys
Last active October 14, 2018 15:44
WooCommerce: Error Redsys con SSL
#Al tener un SSL con SNI o Let's Encrypt, redsys no devuelve bien el estado del pedido pago y lo deja "En Espera"
#Esto se produce porque redsys no es compatible con estos protocolos, por lo tanto hay que saltear el https: en la
#respuesta de redsys. La solución es en el plugin (https://wordpress.org/plugins/woocommerce-sermepa-payment-gateway/)
#elegir el Protocolo para notificaciones HTTP y en el .htacces añadir una exclusión a la regla que redirige de
#HTTP a HTTPS.
# Enviar trafico HTTP a HTTPS
RewriteEngine On
# Si la cadena de consulta no contiene wc-api=WC_MyRedsys
RewriteCond %{QUERY_STRING} !wc-api=WC_MyRedsys [NC]
@maugelves
maugelves / get-last-children-taxonomies-for-post.php
Last active October 28, 2016 19:14
Get the latest child category/ies (those who aren't parent) for a specific post
<?php
/**
* Get the latest hierarchical taxonomy children of a post
*
* @author Mauricio Gelves <[email protected]>
* @param $post_id int Post ID
* @return array
*/
function get_last_children_taxonomy_in_post( $post_id, $taxonomy = 'category'){
@maugelves
maugelves / get-fisrt-paragraph.php
Last active October 28, 2016 19:15 — forked from banago/get-fisrt-paragraph.php
Get first paragraph from a WordPress post.
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @param $class string optional class name to include in the paragraph
* @return string
*/
function get_first_paragraph( $class = '' ){
global $post;
$space-inset-default = 16px 16px 16px 16px;
$space-inset-xs = 4px 4px 4px 4px;
$space-inset-s = 8px 8px 8px 8px;
$space-inset-m = 16px 16px 16px 16px;
$space-inset-l = 32px 32px 32px 32px;
$space-inset-xl = 64px 64px 64px 64px;
$space-stack-default = 0 0 16px 0;
$space-stack-xs = 0 0 4px 0;
$space-stack-s = 0 0 8px 0;
$space-stack-m = 0 0 16px 0;
anonymous
anonymous / functions.php
Created January 25, 2016 15:56
WordPress shortcode to display a category description?
Try this. Add the code below to your functions.php file -
add_shortcode('cat_description', 'my_cat_description_shortcode');
function my_cat_description_shortcode($atts){
$a = shortcode_atts( array(
'id' => 0,
), $atts );
return category_description($a['id']);
@m
m / gist:bab8d366d2e826ba2311
Last active December 4, 2019 00:53
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.
@igmoweb
igmoweb / site-new.php
Last active November 19, 2015 13:54
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',
anonymous
anonymous / RPJGBr.markdown
Created July 13, 2015 21:56
RPJGBr