Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active October 11, 2017 14:16
Show Gist options
  • Save carasmo/579c525c37e121785424d1563d6e01a8 to your computer and use it in GitHub Desktop.
Save carasmo/579c525c37e121785424d1563d6e01a8 to your computer and use it in GitHub Desktop.
Change Loop in WooCommerce for CSS Grid or not floats : This is to be included as a separate file in your theme. If you do it differently, be sure to check that WooCommerce is installed,
<?php
/**
* Theme Name
*
* Adds the required WooCommerce setup functions to the Theme Name
*
* @package Your Package
* @author Your Name
* @license GPLv3 or later
* @license uri https://www.gnu.org/licenses/gpl-3.0.en.html
* @version 1.0.0
*/
if( ! defined( 'ABSPATH' ) ) exit;
add_theme_support( 'woocommerce' );
add_theme_support( 'genesis-connect-woocommerce' );
//* Check for WooCommerce, exit if not active
if ( ! class_exists( 'WooCommerce' ) ) return;
/**
* Add Custom WooCommerce Loop Start
*/
function woocommerce_product_loop_start( $echo = true ) {
ob_start();
echo '<ul class="woo-products">';
if ( $echo ):
echo ob_get_clean();
else:
return ob_get_clean();
endif;
}
/**
* Add Custom WooCommerce Loop End
*/
function woocommerce_product_loop_end( $echo = true ) {
ob_start();
echo '</ul>';
if ( $echo ) :
echo ob_get_clean();
else:
return ob_get_clean();
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment