Using LH Save Down

Installation

  1. Upload the lh-save-down folder to /wp-content/plugins/.
  2. Run composer install inside the plugin directory (or use the LH MCP run-composer ability) to install mPDF and PHPePub into vendor/.
  3. Activate the plugin.
  4. Resave your permalinks (Settings, Permalinks) so the export feeds are registered.

Adding download links

Shown on a single post or page, each link points at a signed download of that page in its format, with rel="nofollow". On archives and other screens with no single post it is left out.

Export URLs

Each format is a WordPress feed on the post’s permalink: lh-save_down.html, lh-save_down.text, lh-save_down.pdf and lh-save_down.epub. A request must also carry a valid lh_save_down-token query argument. The token is an HMAC of the post ID, the format and an expiry time, so it isn’t tied to any user or session and works until it expires. A request without a valid token gets an uncached 404. Build URLs through a menu or navigation link or through the get-export-url ability, rather than by hand.

What is exported

When the block template displaying a post marks a document region (a block with the class lh-md-content) and LH Content Converter 2.3.0+ is active, the export renders that region, which carries its own title. Otherwise it renders the post title followed by the post content. PDF and EPUB document titles and file names always come from the post title.

Customising the output

Copy a template from the plugin’s templates/ directory to the root of the active theme or child theme and edit it there. The plugin uses the theme’s copy when one exists:

Filters