Last active
October 20, 2023 18:20
-
-
Save finalwebsites/8901926f016dc5b0c3f7e97ab0538e50 to your computer and use it in GitHub Desktop.
Add aan extra description to your WooCommerce product archive with ACF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Place this code in your functions.php file to show a short description before the grid on product categorie archive pages. | |
Disclaimer: Use this code snippet with extreme care and at your own risk. | |
*/ | |
add_action('woocommerce_archive_description', function() { | |
if (!is_paged() && is_product_category()) { | |
if (function_exists('get_field')) { | |
$term_id = get_queried_object()->term_id; | |
echo ' | |
<div class="more-category-info"> | |
'.get_field('introtekst', 'product_cat_'.$term_id).' | |
</div>'; // change the first attribute to match your own field name | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment