Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable paywall template instead of the default button #26

Open
bumi opened this issue Feb 13, 2023 · 1 comment
Open

Configurable paywall template instead of the default button #26

bumi opened this issue Feb 13, 2023 · 1 comment

Comments

@bumi
Copy link
Contributor

bumi commented Feb 13, 2023

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.

@Bobz-zg
Copy link
Contributor

Bobz-zg commented Feb 18, 2023

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants