Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1484097

    Since we have an H1 headline on the shop category pages and a lot of text after it, we’ve moved this section below the products.

    This means we don’t have a headline at the top, as otherwise the user wouldn’t see any products for a long time without scrolling.

    Can the headline and text be separated for SEO? If so, how?

    We want to display a filter directly on mobile instead of the sorting.

    In other words, the headline should be visible first, then the filter, and then the products.
    Because currently, the user has to scroll all the way down to filter.

    Link to a category page attached in private content.

    Thanks a lot for helping me!

    #1484124

    Hey awasner,

    Thank you for the inquiry.

    You can add the following code to the functions.php file to separate the title from the term description.

    remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
    remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
    
    add_action( 'woocommerce_before_shop_loop', 'av_woocommerce_before_shop_loop_mod', 5 );
    function av_woocommerce_before_shop_loop_mod() {
        if ( is_product_taxonomy() ) {
            echo '<h1 class="term-title">' . single_term_title( '', false ) . '</h1>';
        }
    }
    
    add_action( 'woocommerce_after_shop_loop', 'av_woocommerce_after_shop_loop_mod', 15 );
    function av_woocommerce_after_shop_loop_mod() {
        if ( is_product_taxonomy() ) {
            $term = get_queried_object();
            if ( isset( $term->description ) && $term->description ) {
                echo '<div class="term-description">' . wpautop( $term->description ) . '</div>';
            }
        }
    }

    Best regards,
    Ismael

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