Customize the appearance of your CatFolders Document Library with ease by adding PHP snippets.
Ex: Add a new column into Display Fields option.
1. Create a custom code and paste it into a Code Snippets plugin.

2. Here is the result, the “User name” column has been added successfully.
Following this process can lead you to your personalized job.
Get this snippet here:
// The hook used to add a new column
add_filter( 'catf_dg_columns', 'catf_dg_add_column', 10, 1 );
/**
* Add a new column
*
* @param array $columns An array used to define label and key of column
* @return array
*/
function catf_dg_add_column( $columns ) {
// Add label and key for new column here
$columns[] = array(
'label' => __( 'User name', 'catfolders-document-gallery' ),
'key' => 'user_name',
);
return $columns;
}
// The hook used to add content of column
add_filter( 'catf_dg_columns_html', 'catf_dg_add_column_html', 10, 3 );
/**
* Add content of columns
*
* @param array $columns Label and key of column
* @param array $file Info of file
* @param array $attr Attributes of table
* @return array
*/
function catf_dg_add_column_html( $columns, $file, $attr ) {
$id = get_the_ID();
$author_id = get_post_field( 'post_author', $id );
$display_name = get_the_author_meta( 'display_name', $author_id );
// Content of column
if ( 'user_name' === $columns['key'] ) {
?>
<td>
<div class=""><?php echo esc_html( $display_name ); ?></div>
</td>
<?php
}
return $columns;
}