Created
April 21, 2014 18:40
-
-
Save justinstern/11152101 to your computer and use it in GitHub Desktop.
WooCommerce Nested Category Layout: hide the subcategory image in the nested categories layout.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the code below to the bottom of your current theme's functions.php: | |
function woocommerce_nested_category_products_content_section( $categories, $product_category_ids ) { | |
global $wp_query, $wc_nested_category_layout; | |
$title = ''; | |
$term = ''; | |
// Build up the sub-category title, starting with the title of the current page category | |
if ( is_product_category() ) { | |
$term = get_term_by( 'slug', get_query_var( $wp_query->query_vars['taxonomy'] ), $wp_query->query_vars['taxonomy'] ); | |
$title = '<span>' . $term->name . '</span>'; | |
} | |
// add any saved up category titles, along with the current | |
foreach ( $categories as $title_cat ) { | |
$url = esc_attr( get_term_link( $title_cat ) ); | |
$title .= ( $title ? ' - ' : '' ) . '<a href="' . $url . '">' . wptexturize( $title_cat->name ) . '</a>'; | |
} | |
// subcategory header | |
echo wp_kses_post( apply_filters( 'wc_nested_category_layout_category_title_html', sprintf( '<h2 class="wc-nested-category-layout-category-title">%s</h2>', $title ), $categories, $term ) ); | |
// optional thumbnail/description of the category | |
$category = $categories[ count( $categories ) - 1 ]; | |
// Optional category description | |
if ( $category->description ) { | |
$description = apply_filters( 'the_content', $category->description ); | |
if ( $description ) { | |
echo '<div class="subcategory-term_description term_description">' . $description . '</div>'; | |
} | |
} | |
WC_Nested_Category_Layout_Plugin_Compatibility::wc_get_template( 'loop/nested-category.php', array( 'woocommerce_product_category_ids' => $product_category_ids, 'category' => $title_cat ), '', $wc_nested_category_layout->plugin_path() . '/templates/' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, with current version of the plugin (1.8.0) you can use this :
add_filter( 'wc_nested_category_layout_category_image', '__return_empty_string');