• Peyton

    (@peytongregory)


    There’s an area on my home page where i want to display the category title, cat description and then 4 subcategory thumbnails with the sub category name beneath the thumbnail.

    The only code i’ve found is this, which doesn’t work. Any ideas?

    add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
    function woocommerce_category_image() {
        if ( is_product_category() ){
    	    global $wp_query;
    	    $cat = $wp_query->get_queried_object();
    	    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    	    $image = wp_get_attachment_url( $thumbnail_id );
    	    if ( $image ) {
    		    echo '<img src="' . $image . '" alt="" />';
    		}
    	}
    }
  • The topic ‘[Pligin: WooCommerce] display category thumbnails on home page’ is closed to new replies.