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.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.