How to create ShortCode

You need to use hooks to create custom columns and data for a custom post type are manage_{$post_type}posts_columns and manage{$post_type}_posts_custom_column respectively.

{$post_type} is the name of the custom post type.

I have created common function to add column and and their data. You can use below function to add column and it’s data.

function cv_add_column_to_admin_dashboard($column_title, $post_type, $cb){
    # Column 
    add_filter( 'manage_' . $post_type . '_posts_columns', function($columns) use ($column_title) {
        $columns[ sanitize_title($column_title) ] = $column_title;
        return $columns;
    } );
    # Column Content
    add_action( 'manage_' . $post_type . '_posts_custom_column' , function( $column, $post_id ) use ($column_title, $cb) {
        if(sanitize_title($column_title) === $column){
            $cb($post_id);
        }
    }, 10, 2 );
}

How to use above function. I have added two columns “Shorcode” and “Template Shortcode” using below function. ‘page’ is post type, you can replace with your custom post type.

# column for shortcode
cv_add_column_to_admin_dashboard(__('Shortcode'), 'page', function($post_id){
    echo '<code>';
    echo '[logo_showcase id="'.$post_id.'"]';
    echo '</code>';
});

# column for template shortcode
cv_add_column_to_admin_dashboard(__('Template Shortcode'), 'page', function($post_id){
    $code="<?php echo do_shortcode("[logo_showcase id="".$post_id.'"]"); ?>';
    echo '<code>'.htmlspecialchars($code).'</code>';
});

Here is a shortcode, you can manage your shortcode output here:

# shortcode
add_shortcode('logo_showcase','logo_showcase_callback');
function logo_showcase_callback($atts)
{
    $html="";
    $atts = shortcode_atts( array(
        'id' => '',
    ), $atts, 'default' );
    
    $id = $atts['id'];
    if(!empty($id))
    {   
       $html .= get_the_title($id);
       # change CUSTOM_FIELD with your custom field name
       $CUSTOM_FIELD = get_post_meta($id,'CUSTOM_FIELD',true);
     }
    return $html;
}

Please use above code in your plugin. Please check and let me know if this works for you.