lightning-publisher-wordpress icon indicating copy to clipboard operation
lightning-publisher-wordpress copied to clipboard

Configurable paywall template instead of the default button

Open bumi opened this issue 2 years ago • 1 comments

Currently we add a default button to unlock the paywall

to be more flexible there we should allow people to render their own HTML template instead of the default button. this gives great flexibility in designing how the paywall looks

We have all the JS and the REST endpoints to allow to do this.

bumi avatar Feb 13 '23 12:02 bumi

The WP way to do this would be to move this method into a template file, and enable override.

  1. Try to load from theme folder: {my-theme}/lightning-publisher-wordpres/button-template.php
  2. Default to plugin folder:/lightning-publisher-wordpres/public/templates/button-template.php

Instructions

  1. In your theme folder create folder: 'lightning-publisher-wordpres'
  2. Copy file "lightning-publisher-wordpres/public/templates/button-template.php" to above folder
  3. Tweak template to your needs

2nd option is to modify via filter hook You also have access to $plugin instance in same template file and you can access all data. Add this snippet to your theme functions.php

add_filter( 'bln_paywall_unpaid_button_template', function( $template, $plugin ) {

	$my_custom_template = get_stylesheet_directory() . '/my-custom-file.php';

	return $my_custom_template;
}, 10, 2 );

Bobz-zg avatar Feb 18 '23 09:02 Bobz-zg