[Support request] WooCommerce Product Categories

Home Forums Support [Support request] WooCommerce Product Categories

Home Forums Support WooCommerce Product Categories

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1660848
    David

    Hey,

    I would like to have the WooCommerce product category descriptions only show on the first page.

    Similar to this here: (using php)
    https://docs.generatepress.com/article/display-category-description-on-first-page-only/

    Thank You for any help.

    #1660877
    Ying
    Staff
    Customer Support

    Hi David,

    Try this:

    add_action( 'wp', function() {
        $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
        if ( 1 !== $page ) {
            remove_action( 'generate_product_archive_title', 'generate_product_archive_title' );
            add_action( 'generate_product_archive_title', 'tu_custom_paged_product_archive_title' );
        };
    }, 20 );
    
    function tu_custom_paged_product_archive_title() {
        ?>
        <header class="page-header">
            <h1 class="page-title">
                <?php the_product_archive_title(); ?>
            </h1>
        </header>
        <?php
    }
    #1660887
    David

    Yes, it works.

    Great support!

    #1660917
    Ying
    Staff
    Customer Support

    No problem 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.