Add Term ID Dynamically
-
Hi,
I saw that this topic: https://www.ads-software.com/support/topic/add-term-id-dinamically/ is closed to new replies, so I thought I’d answer it for the community:
This is my code for a taxonomy template for WooCommerce Attributes with “Archive” enabled.
<?php $dynid_id = get_queried_object()->term_id; // image id is stored as term meta $image_id = get_term_meta( $dynid_id, 'image', true ); // image data stored in array, second argument is which image size to retrieve $image_data = wp_get_attachment_image_src( $image_id, 'full' ); // image url is the first item in the array (aka 0) $image = $image_data[0]; ?>
- The topic ‘Add Term ID Dynamically’ is closed to new replies.