## Display Custom Taxonomy Associated to Post ACF

Question

I tried different solutions I found here, but can’t make it work. I have a custom post type “Properties” and each of the properties has custom taxonomy (diff. multiple categories) which tie-up to advanced custom fields select field (For Sale, For Lease, OffMarket).

I wanted to display all custom taxonomy to a specific page like For Sale and display associated custom taxonomy to the landing page of For Sale. However, I have still displays the custom category which belongs to “For Lease” instead of “For Sale”.

<?php
$taxonomy = 'property_category';$tax_terms = get_terms($taxonomy, [ 'order' => 'ASC', 'hide_empty' => true, 'exclude' => [ 18 ] ]); ?> <li><button data-filter="*" class="is-checked">ALL</button></li> <?php foreach ($tax_terms as $tax_term) { echo '<li>' . '<button data-filter=".' .$tax_term->slug . '" ' . '>' . \$tax_term->name.'</button></li>';
}
?>


Example:

Under the For-Sale landing page, I have “Warehouse”, “For Sale” and “Retail” categories. And for the For-Lease landing page, I have “Ground Lease”, “For Lease”, and “Office”. However, using the code above, it displays all categories even if you are viewing the “For-Sale” or “For-Lease” landing page.

0
3 years 2019-10-21T14:59:16-05:00 0 Answers 79 views 0