• Resolved connor234

    (@connor234)


    Hi there,

    I was curious about how I can add some text beneath the category title as seen here. I had a look around but couldn’t find a suitable hook to use that would allow me to do this.

    Any help is much appreciated.

    Cheers, Connor

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hey @connor234,

    You could override the default woocommerce_template_loop_category_title function from within your theme like this by adding it to the functions.php file.

    function woocommerce_template_loop_category_title( $category ) {
    	?>
    	<h2 class="woocommerce-loop-category__title">
    		<?php
    		echo esc_html( $category->name );
    
    		if ( $category->count > 0 ) {
    		echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . esc_html( $category->count ) . ')</mark>', $category ); // WPCS: XSS ok.
    		}
    
    		echo '<p>Add your text here</p>';
    	?>
    	</h2>
    	<?php
    }

    Screenshot of output

    Image Link: https://cloudup.com/cbpgr0ULeZx

    I hope this helps.

    Thread Starter connor234

    (@connor234)

    Hi Stuart,

    Thanks for your assistance, this has worked for me.

    Cheers, Connor

    • This reply was modified 4 years, 6 months ago by connor234.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Text after Category Title’ is closed to new replies.