function add_new_gallery_columns($gallery_columns) {
$new_columns['cb'] = '<input type="checkbox" />';
$new_columns['title'] = __('Title');;
$new_columns['author'] = __('Author');
$new_columns['specs_'.$_GET['post_type']] = __('Categories');
//$new_columns['tags'] = __('Tags');
$new_columns['date'] = _x('Date', 'column name');
return $new_columns;
}
add_action( 'manage_posts_custom_column' , 'custom_columns' );
function custom_columns( $column ) {
global $post;
switch ( $column )
{
case 'specs_health':
$terms = get_the_term_list( $post->ID , 'specs_health' , '' , ',' , '' );
if ( is_string( $terms ) ) {
echo $terms;
}
else
{
echo 'Please Put In A Category';
}
break;
case 'specs_lifestyle':
$terms = get_the_term_list( $post->ID , 'specs_lifestyle' , '' , ',' , '' );
if ( is_string( $terms ) ) {
echo $terms;
}
else
{
echo 'Please Put In A Category';
}
break;
case 'specs_relationships':
$terms = get_the_term_list( $post->ID , 'specs_relationships' , '' , ',' , '' );
if ( is_string( $terms ) ) {
echo $terms;
}
else
{
echo 'Please Put In A Category';
}
break;
case 'specs_entertainment':
$terms = get_the_term_list( $post->ID , 'specs_entertainment' , '' , ',' , '' );
if ( is_string( $terms ) ) {
echo $terms;
}
else
{
echo 'Please Put In A Category';
}
break;
}
}
This worked for me like a charm. The “specs_whatever” are the names of my custom taxonomies.
hi ssjaime.
try this code its workin for me no problems at all.
add_action( 'right_now_content_table_end' , 'ucc_right_now_content_table_end' );
function ucc_right_now_content_table_end() {
$args = array(
'public' => true ,
'_builtin' => false
);
$output = 'object';
$operator = 'and';
$tag_types = get_taxonomies( $args , $output , $operator );
foreach( $tag_types as $tag_type ) {
$terms = get_terms($tag_type->name);
$num = count($terms);
// $num_posts = wp_count_posts( $tag_type->name );
// $num = number_format_i18n( $num_posts->publish );
$text = _n( $tag_type->labels->singular_name, $tag_type->labels->name , intval( $num_posts->publish ) );
if ( current_user_can( 'edit_posts' ) ) {
$num = "<a href='edit-tags.php?taxonomy=$tag_type->name'>$num</a>";
$text = "<a href='edit-tags.php?taxonomy=$tag_type->name'>$text</a>";
}
echo '<tr><td class="first b b-' . $tag_type->name . '">' . $num . '</td>';
echo '<td class="t ' . $tag_type->name . '">' . $text . '</td></tr>';
}
}
And if you want to show custom post types also past this code also with the previous one in you function.php
add_action( 'right_now_content_table_end' , 'ucc_right_now_content_table_end2' );
function ucc_right_now_content_table_end2() {
$args = array(
'public' => true ,
'_builtin' => false
);
$output = 'object';
$operator = 'and';
$post_types = get_post_types( $args , $output , $operator );
foreach( $post_types as $post_type ) {
$num_posts = wp_count_posts( $post_type->name );
$num = number_format_i18n( $num_posts->publish );
$text = _n( $post_type->labels->singular_name, $post_type->labels->name , intval( $num_posts->publish ) );
if ( current_user_can( 'edit_posts' ) ) {
$num = "<a href='edit.php?post_type=$post_type->name'>$num</a>";
$text = "<a href='edit.php?post_type=$post_type->name'>$text</a>";
}
echo '<tr><td class="first b b-' . $post_type->name . '">' . $num . '</td>';
echo '<td class="t ' . $post_type->name . '">' . $text . '</td></tr>';
}
}
Anonymous User
(@anonymized-1391468)
Excellent, thanks shafraz!