0

enter image description here

Image should explain what I am trying to accomplish. I have no idea how to do this, is anyone familiar with this sort of work?

Custom event date will be a custom event meta box value that is part of the post type. I want the custom meta box to have a column like the taxonomy event essentials(as seen in the picture)

Thanks.

1

There is the hook manage_${post_type}_posts_columns which can be used to do just that.

Basic example:

function wpse188743_events_cpt_columns( $columns ) {
    $new_columns = array(
        'event_date' => __( 'Event Date', 'textdomain' ),
    );
    return array_merge( $columns, $new_columns );
}
add_filter( 'manage_events_posts_columns' , 'wpse188743_events_cpt_columns' );

To fill the column with the related content you additionally have to make use of the manage_posts_custom_column hook.

Basic example:

function wpse188743_event_column_data( $column, $post_id ) {
    switch ( $column ) {
        case 'event_date' :
            echo 'event date logic goes here'; 
            break;
    }
}
add_action( 'manage_posts_custom_column' , 'wpse188743_event_column_data', 10, 2 );
-2

Many thanks for the help. Only one thing, the manage_posts_custom_column has the same functionality as the manage_${post_type}_posts_columns so to use it would also be manage_${post_type_posts_custom_column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.