Hi all
I have a function calling the display of taxonomies being 'project-taxonomy' related to posts having a post_type="projects"
Until so far, no problem.
But I'd like to display only taxonomies 'project-taxonomy' having posts from post_type="projects" AND a meta_key='display_homepage' with meta_value=1
Is it possible?
The goal being not display the taxonomies which have not posts with this condition (meta_key='display_homepage' with meta_value=1)
My current function is the following:
function projects_get_filters( $taxonomy ) {
$terms = get_terms( $taxonomy );
$count = count( $terms );
if ( $count > 0 ) { ?>
<div class="projects-categories filter-button-group">
<button class="shz-btn--s active" data-filter="*"><?php esc_html_e( 'Tout', 'text-domain' ); ?></button>
<?php foreach ( $terms as $term ) { ?>
<button class="shz-btn--s" data-filter=".<?php echo esc_attr( $term->slug ); ?>"><?php echo esc_html( $term->name ); ?></button>
<?php } ?>
</div>
<?php
}
}
And I call it with:
projects_get_filters( 'project-taxonomy' );
Thank you for your help and ideas