WP Manifestindependent plugin directory
manifest / media / documents-download

Documents Download

Upload files with Document Type, Language, and Product Categories. Customers download via shortcode.

by K.Paradorn · github.com/paradonk/documents-download

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/paradonk/documents-download/archive/refs/heads/main.zip

Readme

Documents Download

A WordPress plugin for uploading downloadable documents (brochures, spec sheets, etc.), categorising them, and letting site visitors download them directly via a shortcode.

Features

  • Custom post type (cd_download) for managing downloads, listed in the admin menu as Products.
  • Three hierarchical taxonomies: Document Types, Languages, and Product Categories.
  • wp.media uploader metabox for attaching a file to each download.
  • Admin list table with taxonomy filter dropdowns.
  • [documents_download] shortcode rendering a table of all published downloads with a one-click download link.
  • Force-download handler that validates post type, publish status, and file existence before streaming the file with Content-Disposition: attachment.

Installation

  1. Copy the documents-download folder to /wp-content/plugins/.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Go to Products > Add New, give it a title, and upload a file via the Download File metabox.
  4. Assign Document Type / Language / Product Category terms as needed.
  5. Add the [documents_download] shortcode to any page or post to display the downloads table.

Shortcode usage

[documents_download]

Shows all published downloads in a table (public).

[documents_download require_login="1"]

Hides the table from visitors who aren't logged in.

Note: require_login only controls whether the table/links are displayed. The direct-download URL (?direct_download=1&file_id=N) is not itself access-restricted, so don't rely on this attribute to protect files that must stay private — it's intended for openly downloadable material like public brochures.

How downloads work

Each download link points to:

/?direct_download=1&file_id=<post_id>

On init, CD_Download_Handler checks that the post exists, is of type cd_download, is published, and has a valid attached file, then streams it directly rather than exposing the underlying uploads-folder URL.

File structure

documents-download/
├── documents-download.php          # Plugin bootstrap
├── assets/
│   ├── css/admin.css
│   ├── css/frontend.css
│   └── js/admin-uploader.js        # wp.media integration for the metabox
└── includes/
    ├── class-cd-cpt.php            # Post type + taxonomies
    ├── class-cd-metabox.php        # File upload metabox
    ├── class-cd-admin-list.php     # Admin list columns & taxonomy filters
    ├── class-cd-shortcode.php      # [documents_download] shortcode
    └── class-cd-download-handler.php  # Force-download handler

Requirements

  • WordPress 5.6+
  • PHP 7.4+

License

GPLv2 or later.

Read the full README on GitHub →