• Hi,

    I added a subtitle to each product that is perfectly shown in a single product details, but not is visible at general shop products. I add this code at functions.php:

    function kia_add_subtitle_to_woocommerce(){
        if( function_exists( 'the_subtitle' ) ) the_subtitle( '<h2 class="subtitle">', '</h2>' );
    }
    add_action( 'woocommerce_single_product_summary', 'kia_add_subtitle_to_woocommerce', 7 );
    add_action ('woocommerce_shop_loop_item_title', 'kia_add_subtitle_link_to_woocommerce');

    What am I doing wrong? Thanks in advance!

    David

    https://www.ads-software.com/plugins/kia-subtitle/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    kia_add_subtitle_link_to_woocommerce isn’t a defined function in this snippet.

    It should probably be:

    add_action ('woocommerce_shop_loop_item_title', 'kia_add_subtitle_to_woocommerce');

    `

    that would not link to the product, but it should display the subtitle.

    Thread Starter xikixak

    (@xikixak)

    Thanks for your answer, but still not shows subtitle with this code:
    add_action ('woocommerce_shop_loop_item_title', 'kia_add_subtitle_to_woocommerce');

    Plugin Author HelgaTheViking

    (@helgatheviking)

    This code

    function kia_add_subtitle_to_woocommerce(){
        if( function_exists( 'the_subtitle' ) ) the_subtitle( '<h2 class="subtitle">', '</h2>' );
    }
    add_action( 'woocommerce_single_product_summary', 'kia_add_subtitle_to_woocommerce', 7 );
    add_action ('woocommerce_shop_loop_item_title', 'kia_add_subtitle_to_woocommerce');

    works with Twenty Sixteen, so if it isn’t working for you then I have to presume that your theme has modified the WooCommerce templates and no longer has a woocommerce_shop_loop_item_title hook.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show subtitle at shop home’ is closed to new replies.