Developer-Friendly Plugin
This WP Display Files plugin for WordPress is developer-friendly. Website admins can control its various aspects using hooks. Below is a list of code snippets for this plugin.
wpdf_file_name
– You can use this hook to rename file name in frontend listing.
add_filter( 'wpdf_file_name', 'wpdf_rename_file_to_listing', 10, 2 );
function wpdf_rename_file_to_listing( $filename, $Shortcode_id ) {
// Condition goes here
return $filename;
}
wpdf_folder_name
– You can update the folder name in front-end listing.
add_filter( 'wpdf_folder_name', 'wpdf_rename_folder_to_listing', 10, 2 );
function wpdf_rename_folder_to_listing( $name, $id ) {
// Condition goes here
return $name;
}
wpdf_exclude_by_extention
– You can avoid to show any files with a particular file extention in the front-end listing.
add_filter( 'wpdf_exclude_by_extention', 'wpdf_exclude_by_extention',10, 2 );
function wpdf_exclude_by_extention( $exclude,$shortcode_id ){
if(true){ // Update your condition here
$exclude[] = 'php';
$exclude[] = 'js';
}
return $exclude;
}
wpdf_exclude_by_name
– You can avoid to show any files / folders with particular name in the front-end listing.
add_filter( 'wpdf_exclude_by_name', 'wpdf_exclude_by_name',10, 2 );
function wpdf_exclude_by_name( $exclude,$shortcode_id){
if(true){ // Update your condition here
$exclude[] = 'Sub Folder 1';
$exclude[] = 'team-developers.jpg';
}
return $exclude;
}
wpdf_include_by_extention
– Displays files with particular file extention only. Skips rest of the files from listing to display.
add_filter( 'wpdf_include_by_extention', 'wpdf_include_by_extention',10, 2 );
function wpdf_include_by_extention( $include,$shortcode_id){
$include[] = 'pdf';
return $include;
}
wpdf_include_by_name
– Displays specific files / folders only in the frontend list. Skips rest of the files to be displayed.
add_filter( 'wpdf_include_by_name', 'wpdf_include_by_name',10, 2 );
function wpdf_include_by_name( $include,$shortcode_id){
$include[] = 'Document.odt';
$include[] = 'My Holidays';
return $include;
}
wpdf_go_back_btn_title
– Filter you can use to update the text of Go Back button in side list and dark side list template.
add_filter( 'wpdf_go_back_btn_title', 'wpdf_go_back_btn_title',10,2);
function wpdf_go_back_btn_title($button_title , $id){
if(true){ //Update your condition here
$button_title = 'Go Back';
return $button_title;
}
}
wpdf_no_files_found_msg
– Filter you can use to update the text of no files found message in the frontend listing.
add_filter( 'wpdf_no_files_found_msg', 'wpdf_no_files_found_msg',10,2);
function wpdf_no_files_found_msg($no_files_message , $wpdf_data){
if(true) { //Update condition according to requirements.
$no_files_message = 'No file or folder found with specified name';
}
return $no_files_message;
}
wpdf_files_heading
– Filter you can use to update the heading of file listing section in template grid view and dark grid view.
add_filter( 'wpdf_files_heading', 'wpdf_files_update_heading', 10,2);
function wpdf_files_update_heading($heading , $id){
$heading = 'File Listing : ';
return $heading;
}
wpdf_folders_heading
– Filter you can use to update the heading of folder listing section in template grid view and dark grid view.
add_filter( 'wpdf_folders_heading', 'wpdf_folders_update_heading', 10,2);
function wpdf_folders_update_heading($heading , $id){
$heading = 'Folder Listing : ';
return $heading;
}
wpdf_update_pagination_status
– Enable / disable pagination functionality in grid veiw, dark grid view for a particular page
add_filter('wpdf_update_pagination_status','wpdf_update_pagination_status',10,1 );
function wpdf_update_pagination_status( $paginate ){
if(true){ // Update condition here like you can check if we are on a particular page.
$paginate = false;
}
return $paginate;
}
wpdf_update_listing_per_page
– Update no of per page items in pagination functionality for a particular page
add_filter('wpdf_update_listing_per_page','wpdf_update_listing_per_page',10,1 );
function wpdf_update_listing_per_page( $per_page ){
if(true){ // Update condition here like you can check if we are on a particular page.
$per_page = '20';
}
return $per_page;
}
wpdf_update_template
– Change the front-end listing template on a particular page
add_filter('wpdf_update_template','wpdf_update_template',10,1 );
function wpdf_update_template( $template ){
if(true){ // Update condition here like you can check if we are on a particular page.
$template = 'layout_3';
}
// Possible values can be layout_1 to layout_6
return $template;
}