Not working with theme
-
Hi, I just downloaded your plugin, thanks for creating it. I activated it and changed the shop columns. I nedd them to be 4 (or at least 3) but my products keep showing up in a weird 2/1 column layout. I Think there must be a conflict with the theme I′m using.
Here′s the related code on the theme content.php file, if you could have a look I′d really appreciate any suggestions, thanks!
// Change number of products per page
add_filter(‘loop_shop_per_page’, ‘tpath_woo_loop_shop_per_page’);function tpath_woo_loop_shop_per_page() {
global $tpath_options;parse_str($_SERVER[‘QUERY_STRING’], $params);
if( isset( $tpath_options[‘tpath_loop_products_per_page’] ) && $tpath_options[‘tpath_loop_products_per_page’] != ” ) {
$products_per_page = $tpath_options[‘tpath_loop_products_per_page’];
} else {
$products_per_page = 12;
}$product_count = !empty($params[‘product_count’]) ? $params[‘product_count’] : $products_per_page;
return $product_count;
}// Change number of products per row to 4
add_filter(‘loop_shop_columns’, ‘tpath_woo_loop_columns’);function tpath_woo_loop_columns() {
global $tpath_options;
if( isset( $tpath_options[‘tpath_loop_shop_columns’] ) && $tpath_options[‘tpath_loop_shop_columns’] != ” ) {
$product_columns = $tpath_options[‘tpath_loop_shop_columns’];
} else {
$product_columns = 3;
}return $product_columns;
}// Related Products Count
remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 );
add_action(‘woocommerce_after_single_product_summary’, ‘tpath_woocommerce_output_related_products’, 15);function tpath_woocommerce_output_related_products() {
global $tpath_options;if( isset( $tpath_options[‘tpath_related_products_count’] ) && $tpath_options[‘tpath_related_products_count’] != ” ) {
$related_count = $tpath_options[‘tpath_related_products_count’];
} else {
$related_count = 3;
}$args = array(
‘posts_per_page’ => $related_count,
‘columns’ => $related_count,
‘orderby’ => ‘rand’
);woocommerce_related_products( apply_filters( ‘woocommerce_output_related_products_args’, $args ) );
}
- The topic ‘Not working with theme’ is closed to new replies.