Skip to content

Instantly share code, notes, and snippets.

@robertdevore
Last active April 30, 2017 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertdevore/0a91a333b4bb2c3d6106d7124ed0e867 to your computer and use it in GitHub Desktop.
Save robertdevore/0a91a333b4bb2c3d6106d7124ed0e867 to your computer and use it in GitHub Desktop.
WP Dispensary - display categories at the bottom of the Details table
<?php
/**
* WPD - Display categories in the Data Details table
*/
add_action( 'wpd_dataoutput_bottom', 'add_wpd_categories' );
function add_wpd_categories() { ?>
<?php if ( in_array( get_post_type(), array( 'flowers' ) ) ) { ?>
<tr><td><span>Categories:</span></td><td><?php echo get_the_term_list( $post->ID, 'flowers_category', '', ', ' ); ?></td></tr>
<?php } ?>
<?php if ( in_array( get_post_type(), array( 'concentrates' ) ) ) { ?>
<tr><td><span>Categories:</span></td><td><?php echo get_the_term_list( $post->ID, 'concentrates_category', '', ', ' ); ?></td></tr>
<?php } ?>
<?php if ( in_array( get_post_type(), array( 'edibles' ) ) ) { ?>
<tr><td><span>Categories:</span></td><td><?php echo get_the_term_list( $post->ID, 'edibles_category', '', ', ' ); ?></td></tr>
<?php } ?>
<?php if ( in_array( get_post_type(), array( 'topicals' ) ) ) { ?>
<tr><td><span>Categories:</span></td><td><?php echo get_the_term_list( $post->ID, 'topicals_category', '', ', ' ); ?></td></tr>
<?php } ?>
<?php if ( in_array( get_post_type(), array( 'growers' ) ) ) { ?>
<tr><td><span>Categories:</span></td><td><?php echo get_the_term_list( $post->ID, 'growers_category', '', ', ' ); ?></td></tr>
<?php } ?>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment