Skip to content

Instantly share code, notes, and snippets.

View thelonelycats's full-sized avatar

thelonelycats

View GitHub Profile
@thelonelycats
thelonelycats / functions.php
Last active March 5, 2017 13:55
Replace shop and archive woocommerce title and description with Genesis archive settings
<?php
/* add Genesis post type archive support for product archive (shop page) */
function my_custom_init() {
add_post_type_support( 'product', 'genesis-cpt-archives-settings' );
}
add_action('init', 'my_custom_init');
/* remove woocommerce title and description in shop and archive pages */
add_filter( 'woocommerce_show_page_title', '__return_false' );
remove_action( 'woocommerce_archive_description','woocommerce_product_archive_description',10 );
<?php
/* layered navigation hide out of stock items
** Función para comprobar si los productos listados, con el filtro pa_size tienen stock para la variación indicada
*/
function product_in_stock($post, $product) {
if ($_GET['filtering'] == 1 && $_GET['filter_size'] > 0 ) {
$STOCK = FALSE;
$slugmap = array();
$attribs = $product->get_variation_attributes();
$terms = get_terms( sanitize_title( 'pa_size' ));