Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add id column to post category taxonomy #48

Closed
mmjaeger opened this issue Mar 20, 2019 · 4 comments
Closed

add id column to post category taxonomy #48

mmjaeger opened this issue Mar 20, 2019 · 4 comments

Comments

@mmjaeger
Copy link

Hello
How could I add an ID column to the posts -> categories edit screen?

@mmjaeger
Copy link
Author

got it to work like - hope that's the right way to do it
`$cats = new Taxonomy( 'category' );
$cats->posttype( 'post' );

$cats->columns()->add( array(
	'pid' => __( 'ID' ),
) );

$cats->columns()->populate( 'pid', function ( $content, $column, $term_id ) {
	echo $term_id;
} );

$cats->columns()->order( array(
	'pid' => 1
) );

$cats->register();	// register category for posttype 'gear'`

@mmjaeger
Copy link
Author

what's not working though is adding a column to the post_type "attachment" like this:`

$atts = new PostType( 'attachment' );
$atts->columns()->add( array(
	'pid'	=> __( 'ID' ),
) );

$atts->columns()->populate( 'pid', function ( $column, $post_id ) {
	echo $post_id;
} );
	
$atts->columns()->order( array(
	'pid' => 1
) );

$atts->register();`

am I missing something??

@jjgrainger
Copy link
Owner

@mmjaeger The attachment post type has a slightly different actions and filters to other post types.

This has been raised in another issue (#5) and will be looking into a fix.

@jjgrainger
Copy link
Owner

Closing this issue out in favour of #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants