这就是我最终使用的原因Milo, 这个Codex 这篇文章来自http://simple2kx.com/.
add_action( \'manage_issues_pm_posts_custom_column\', \'my_manage_issues_pm_columns\', 10, 2 );
function my_manage_issues_pm_columns( $column, $post_id ) {
global $post;
switch( $column ) {
/* If displaying the \'issues_type\' column. */
case \'issues_type\' :
if ( $terms = get_terms( \'issues_type\' ) ) {
echo \'<span>\';
foreach ( $terms as $term ) {
// The $term is an object, so we don\'t need to specify the $taxonomy.
$term_link = get_term_link( $term );
// If there was an error, continue to the next term.
if ( is_wp_error( $term_link ) ) {
continue;
}
// We successfully got a link. Print it out.
echo \'<a class="\' . $term->name . \'" href="\' . esc_url( $term_link ) . \'" data-type="label">\' . $term->name . \'</a>\';
}
echo \'</span>\';
}
break;
/* Just break out of the switch statement for everything else. */
default :
break;
}
一旦我的颜色选择器再次工作,我会将其添加到我的代码中,以便动态分配背景颜色。如果有人想知道,我可能会使用内联样式来设置当前的背景色
class="\' . $term->name . \'"
在href中。