Show all Terms with wp_get_object_terms
-
Hello,
is there a way to show all taxonomies I have and then mark the ones that are selected in the Post?Like:
My Sports:
Football – YES
Tennis – NO
Icehockey – NO
Basketball – YES
Sailing – YESRight now I list all the YES taxonomies with:
function check_rock_details() { global $post; $rock_details = wp_get_object_terms( $post->ID, 'rock_details' ); if ( ! empty( $rock_details ) ) { if ( ! is_wp_error( $rock_detailss ) ) { echo '<table border="1"><tr><td colspan="2">Details</td></tr>'; foreach( $rock_details as $rock_detail ) { echo '<tr><td>' . esc_html( $rock_detail->name ) . '</td><td>YES</td></tr>'; } echo '</table>'; } } } add_shortcode( 'rock_details', 'check_rock_details' );
How do I create a List ith both, YES and NO?
Thanks for some suggestions,
Denis
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Show all Terms with wp_get_object_terms’ is closed to new replies.