Skip to content

Instantly share code, notes, and snippets.

@webaware
webaware / add-to-cart.php
Last active October 9, 2024 00:33 — forked from mikejolley/functions.php
WooCommerce purchase page add-to-cart with quantity and AJAX, by customising the add-to-cart template in the WooCommerce loop. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @link http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @link https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme
@tristanmason
tristanmason / gist:03b63626497475278e1e8d238f35e780
Created March 30, 2021 16:25
Check for Astra Advanced Headers and add header ID class to Wordpress body classes for per-header styling
/**
* Check for Astra Advanced Headers and add header ID class to body classes for per-header styling
* @author Tristan Mason <tristanmason.com>
*/
function tmac_add_advanced_header_class( $classes ) {
// only run if Advanced Headers exists and is enabled on this page
if ( (int)method_exists('Astra_Ext_Advanced_Headers_Data', 'get_current_page_header_ids') && in_array('ast-advanced-headers',$classes) ) {
$tmac_header_ids = Astra_Ext_Advanced_Headers_Data::get_current_page_header_ids();
$classes[] = 'tmac-header-id-' . $tmac_header_ids;
}