Move category description to bottom of page on Wor

2019-04-26 15:50发布

I really need help to move the category description to the bottom of the category page between the pagination and the footer?

I have absolutely no idea which file to look for...

4条回答
我想做一个坏孩纸
2楼-- · 2019-04-26 16:14
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>

<?php endif; ?>

<?php do_action( 'woocommerce_archive_description' ); ?>

Markus G, In case of pagination 'woocommerce_archive_description' is not work for inner paginated pages.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-04-26 16:21

try <?php echo category_description(); ?> rather than <?php do_action( 'woocommerce_archive_description' ); ?> and the 2nd code gives more than just the description.

You will also want to delete the description being outputted by your wootheme that noone except for backups seems to be addressing?

查看更多
Viruses.
4楼-- · 2019-04-26 16:25

you have to change the archive-product.php in

/wp-content/plugins/woocommerce/templates

find this and paste it before the woocommerce_after_main_content_hook :

        <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>

    <?php endif; ?>

    <?php do_action( 'woocommerce_archive_description' ); ?>

just solved the same problem

查看更多
祖国的老花朵
5楼-- · 2019-04-26 16:30

add this to the theme functions.php

   remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );

   add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 100 );

   add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );

you can also change the layout by adding this function also and change the echo code.

        function woocommerce_taxonomy_archive_description() {
    if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) {
        $description = wpautop( do_shortcode( term_description() ) );
        if ( $description ) {
            echo '<div class="term-description">' . $description . '</div>';
        }
    }
}
查看更多
登录 后发表回答