Templates
Document Library Pro uses PHP templating to display the grid cards, submission form, and image lightbox.
Template location
All templates are included in the /templates
folder within the plugin. On your web server this location would be:
<root>/wp-plugins/document-library-pro/templates/
The templates
Within the /templates
folder you will find subfolders and files for the following:
admin
- Controls the display of admin metaboxes.form-fields
- Controls the display of frontend submission form fields.grid-card
- Controls the display of elements in the cards on the grid layout.photoswipe.php
- Controls the display of the lightbox.comments.php
- This is used to disable comments in some themes.
Overriding a template
To override a template, you need to copy the required template to your theme folder and place it in the folder /dlp_templates/
within your theme folder.
For example, if you wanted to override the title.php
template contained under the /grid-card/
template folder, you would copy title.php
to your theme at this location:
/wp-content/themes/<your theme>/dlp_templates/grid-card/title.php
if you wanted to override the photoswipe.php
template contained in the template folder, you would copy photoswipe.php
from the plugin to your theme at this location:
/wp-content/themes/<your theme>/dlp_templates/photoswipe.php
Grid cards
Grid cards can be customized in multiple ways:
- Using the grid card hooks. This is useful if you want to insert some extra information somewhere on the grid card - see this article for a visual representation of the hooks.
- Overriding with custom templates to replace specific parts of the grid card. These are located in `templates/grid-card`
- Completely redesign the grid card using the
document_library_pro_grid_html
filter - see the filter documentation here.
Single Document Page
If you would like to completely replace the single document template then you can follow the steps below:
- Disable the
document_library_pro_enable_single_content_customization
filter using the code below.add_filter( 'document_library_pro_enable_single_content_customization', '__return_false' );
- Create a custom
single-dlp_document.php
template in the root of your theme. A sample single template is available to download here.