function neckbeard_header_cart() { if (is_woocommerce_activated()) { if (is_cart()) { $class = 'current-menu-item'; } else { $class = ''; } ?> <ul class="site-header-cart menu"> <li class="<?php echo esc_attr($class); ?> "> <?php neckbeard_cart_link(); ?> </li> <li> <?php the_widget('WC_Widget_Cart', 'title='); ?> </li> </ul> <?php } }
function neckbeard_cart_link_fragment($fragments) { global $woocommerce; ob_start(); neckbeard_cart_link(); $fragments['a.cart-contents'] = ob_get_clean(); return $fragments; }