Support

Account

Home Forums General Issues Custom field on category page Reply To: Custom field on category page

  • Hi!

    Yep, I have solved it.

    I had to add 2nd description on category pages, so I created custom field ‘second_description’ and put this code (below) at the file woocommerce file ‘archive-product.php’

    <?php

    // vars
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;

    // load desc for this taxonomy term (term object)
    $sec_descrip = get_field(‘second_description’, $queried_object);

    // load desc for this taxonomy term (term string)
    $sec_descrip = get_field(‘second_description’, $taxonomy . ‘_’ . $term_id);

    ?>

    <div class=”term-description”><?php the_field( ‘second_description’, $queried_object ); ?></div>