Home » Php » php – Move category description to bottom of page on WordPress

php – Move category description to bottom of page on WordPress

Posted by: admin July 12, 2020 Leave a comment

Questions:

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…

How to&Answers:

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

Answer:

add this to the theme functions.php

remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
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>';
    }
  }
}

Answer:

<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.

Answer:

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?