1. Home
  2. Knowledge Base
  3. Document Library Pro
  4. Developer Documentation

Template functions

dlp_get_doc_library

This function can be used in your theme or plugin to retrieve a document library, passing a list of arguments as an array.

Arguments

array $args - The list of arguments to create the document library. The array keys supplied should match the shortcode option names. List-based arguments (such as the columns option) can be passed as a comma-separated string or an array.

Return

string - The complete HTML for the document library.

Example
$table = dlp_get_doc_library( [
    'columns' => 'title,author,date', 
    'filters' => true, 
    'doc_category' => 'featured'
] );

dlp_the_doc_library

Similar to the above function, but will print (i.e. echo) the document library output, rather than return it.

Example
echo '<h2>Daily reports</h2>';
dlp_the_doc_library( [ 
    'doc_category' => 'daily-reports',
    'lazy_load' => true
] );
Arguments

array $args - The list of arguments to create the document library table. The array keys supplied should match the shortcode option names. List-based options (such as the columns option) can be passed as a comma-separated string or an array.

dlp_get_document

This function can be used in your theme or plugin to retrieve a document object, passing the id as an argument.

Arguments

int $id - The ID of the document.

Return

Barn2\Plugin\Document_Library_Pro\Document - A document object.

Example
$document = dlp_get_document( 10 );

echo $document->get_download_url();

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.