admin columns not working
Support › MB Admin Columns › admin columns not working
- This topic has 12 replies, 2 voices, and was last updated 6 years, 9 months ago by
stijlXpres.
-
AuthorPosts
-
July 17, 2017 at 4:53 PM #6337
stijlXpres
ParticipantHi,
For some reason I can't get the extension Admin Columns to work. I have the TGM activation in place and seems to work fine.
Other plugins, like Include Exclude, work fine. But Admin Columns does not.
What am I missing?July 17, 2017 at 10:39 PM #6339Anh Tran
KeymasterHi,
How do you setup the columns to show?
July 18, 2017 at 5:26 PM #6356stijlXpres
ParticipantHey Anh Tran,
As far as I understand I just follow the steps as mentioned in the documentation. What I'v tried so far:
'admin_columns' => true,
'admin_columns' => 'after title',
but also the more advanced ways as described in your documenation.
BTW: The link in the sidebar to 'MB Admin Columns' gives a 404.
July 18, 2017 at 5:33 PM #6358Anh Tran
KeymasterCan you post full code of your meta box to check?
PS: I fixed the link in the sidebar. Thanks a lot!
July 18, 2017 at 6:49 PM #6359stijlXpres
ParticipantSure, here we go:
$meta_boxes[] = array( 'title' => __( 'View', 'transport' ), 'post_types' => 'transport', 'fields' => array( array( 'id' => 'show', 'name' => __( 'Related', 'transport' ), 'type' => 'post', 'post_type' => 'page', 'field_type' => 'checkbox_list', 'admin-columns' => array( 'position' => 'before date', 'title' => __( 'Related', 'transport' ), 'sort' => true, ), ), ), );
July 19, 2017 at 8:55 AM #6361Anh Tran
KeymasterHi, is that really
admin-columns
or you mistyped? It should beadmin_columns
, underscore.July 19, 2017 at 7:50 PM #6365stijlXpres
ParticipantHi, that was a typo. 'admin_columns' does not fix the issue.
Before using this extension, I manually added some columns in the code. Could it be that this couses the trouble?
July 21, 2017 at 8:56 AM #6380Anh Tran
KeymasterHi, I'd like to see what you've done with your custom code. I guess you added or renamed an existing column, so Admin Columns extension couldn't find it to "hook" other columns to.
July 21, 2017 at 1:34 PM #6383stijlXpres
ParticipantHi Anh, this is the custom code I used for showing / hiding custom admin columns:
add_filter( 'manage_transport_posts_columns', 'set_transport_columns' ); function set_transport_columns($columns) { unset( $columns['date'] ); $columns['show'] = __( 'Koppeling', 'transport' ); $columns['date'] = 'Datum'; set( $columns['date'] ); return $columns; } add_action( 'manage_transport_posts_custom_column' , 'transport_columns', 10, 2 ); function transport_columns( $column, $post_id ) { switch ( $column ) { case 'show': echo get_post_meta( $post_id, 'show', true ); break; } }
July 21, 2017 at 3:34 PM #6386Anh Tran
KeymasterOh, I see your custom code set a column
show
and you have a custom field with the same ID. Then you set that custom field displayed in admin columns, which already exists there. It might be confused. I'd suggest removing your custom code and try again.July 11, 2018 at 9:00 PM #10522stijlXpres
ParticipantHi,
The issue of the missing admin columns keep occuring. For some unknown reason I can't get the admin columns to show. It works fine on one CPT, but is having trouble on another.
Even when I make a copy of a working CPT, it stops working. I have no idea where to look know.
Can you help me out?
July 12, 2018 at 10:13 AM #10533Anh Tran
KeymasterHi,
Can you post your full code so I can check it out?
July 12, 2018 at 1:57 PM #10537stijlXpres
ParticipantHi,
Hereby the code:
https://ghostbin.com/paste/ssuu2
As said, this code works fine for one CPT, but doesn't for another. Only difference between both are the funcion-titles and post-type names.
Could it be caused because of a earlier error where something is going wrong in building or filling a database table?
What makes me think that is when I rename 'suppliers' to 'sponsors', I get the same issue. -
AuthorPosts
- You must be logged in to reply to this topic.