Display product category under title

I want to display the Product category under my product items title after <span class="price">
For example see this screenshot https://puu.sh/rx0iz/7bbcfa0bf0.png from beshop theme. I want to make a shop like that. 

I found a thread from kriesi using enfold theme asking this same question and author provided a workaround to make it happen. Anyway this code can be tweaked to work with betheme?

Thanks for looking. 

Comments

  • Hi,

    we did never tested it so we don't know if this would work with BeTheme unfortunately.

    Thanks.
  • It wouldn't work because that code uses there builders hooks. It'd need to be based on whatever hooks betheme uses for displaying products.
    Can you look into it?
  • When we finish hundreds of features that are currently on "to do" list, then we will be able to have a loko on it as well but please notice that what we have on current list, would take us many months for sure.
  • Can you answer me maybe what file and hooks I should look for then? I can edit it myself but looking at the files couldn't find where woo com product titles and prices are generated for shop pages? 

    What php file generates the woo com titles and prices for the shop pages in betheme?
  • What you ask for, requires files customization what in reference to Item Support Policy is not allowed. So if you want to modify files and don't know how, you should contact with your web developer.

    P.S. All files responsible for WooCommerce that comes with the BeTheme are located under woocommerce folder.
  • edited October 2016
    I wasn't asking you to edit the files for me, simply tell me where it happens... Since support couldn't help out I ended up researching some more and found this to work when placed in end of theme-functions.php maybe it'll help other who search from Google.



    add_action( 'woocommerce_after_shop_loop_item_title', 'add_product_cat', 1);
    function add_product_cat()
    {
    global $product;
    $product_cats = wp_get_post_terms($product->id, 'product_cat');
    $count = count($product_cats);
    foreach($product_cats as $key => $cat)
    {
    echo '' . $cat->name .'';
    if($key < ($count-1))
    {
    echo ', ';
    }
    }
    }
Sign In or Register to comment.