diff --git a/wordpress/wp-content/plugins/memberful-wp/src/admin.php b/wordpress/wp-content/plugins/memberful-wp/src/admin.php index 5a9a178c..12eed29a 100755 --- a/wordpress/wp-content/plugins/memberful-wp/src/admin.php +++ b/wordpress/wp-content/plugins/memberful-wp/src/admin.php @@ -730,6 +730,7 @@ function memberful_wp_global_marketing() { update_option( 'memberful_use_global_marketing', true ); update_option( 'memberful_global_marketing_override', filter_input( INPUT_POST, 'memberful_global_marketing_override', FILTER_SANITIZE_NUMBER_INT ) ); update_option( 'memberful_use_global_snippets', (int) isset( $_POST['memberful_use_global_snippets'] ) ); + update_option( 'memberful_paragraph_count', memberful_wp_clamp_paragraph_count( (int) filter_input( INPUT_POST, 'memberful_paragraph_count', FILTER_SANITIZE_NUMBER_INT ) ) ); $paywall_input = filter_input( INPUT_POST, 'memberful_paywall', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); if ( is_array( $paywall_input ) && ! empty( $paywall_input ) ) { @@ -749,12 +750,14 @@ function memberful_wp_global_marketing() { $use_global_snippets = get_option( 'memberful_use_global_snippets'); $global_marketing_content = get_option( 'memberful_global_marketing_content' ); $global_marketing_override = get_option( 'memberful_global_marketing_override', true ); + $paragraph_count = memberful_wp_paragraph_count(); memberful_wp_render( 'global_marketing', array( 'use_global_marketing' => $use_global_marketing, 'use_global_snippets' => $use_global_snippets, + 'paragraph_count' => $paragraph_count, 'global_marketing_content' => $global_marketing_content, 'global_marketing_override' => $global_marketing_override, 'paywall_config' => Memberful_Paywall_Config::get(), diff --git a/wordpress/wp-content/plugins/memberful-wp/src/content_filter.php b/wordpress/wp-content/plugins/memberful-wp/src/content_filter.php index b399ffde..0350b167 100755 --- a/wordpress/wp-content/plugins/memberful-wp/src/content_filter.php +++ b/wordpress/wp-content/plugins/memberful-wp/src/content_filter.php @@ -1,7 +1,30 @@ ', $teaser_offset ); if ( $paragraph_offset === false ) { @@ -119,3 +117,22 @@ function memberful_get_teaser_css(){ return $css; } + +/** + * Recut the archive listing excerpt to the configured paragraph count. + * + * @param string $teaser Teaser produced for the listing. + * @param string $content Full rendered post content. + * @return string + */ +function memberful_wp_apply_paragraph_count_to_listing_excerpt( $teaser, $content ) { + if ( ! function_exists( 'memberful_wp_first_paragraphs' ) ) { + return $teaser; + } + + if ( false !== strpos( (string) $content, memberful_wp_get_paywall_divider_marker() ) ) { + return $teaser; + } + + return memberful_wp_first_paragraphs( (string) $content, memberful_wp_paragraph_count() ); +} diff --git a/wordpress/wp-content/plugins/memberful-wp/src/options.php b/wordpress/wp-content/plugins/memberful-wp/src/options.php index 6bc569b2..de88570a 100755 --- a/wordpress/wp-content/plugins/memberful-wp/src/options.php +++ b/wordpress/wp-content/plugins/memberful-wp/src/options.php @@ -30,6 +30,7 @@ function memberful_wp_all_options(): array { 'memberful_use_global_snippets' => TRUE, 'memberful_global_marketing_override' => TRUE, 'memberful_global_marketing_content' => '', + 'memberful_paragraph_count' => 2, 'memberful_ad_provider_settings' => array(), Memberful_Paywall_Config::OPTION_KEY => array(), ); diff --git a/wordpress/wp-content/plugins/memberful-wp/stylesheets/admin.css b/wordpress/wp-content/plugins/memberful-wp/stylesheets/admin.css index 137517fe..82771770 100755 --- a/wordpress/wp-content/plugins/memberful-wp/stylesheets/admin.css +++ b/wordpress/wp-content/plugins/memberful-wp/stylesheets/admin.css @@ -167,6 +167,19 @@ Global Marketing Tools padding-left: 2em; } +/* "Paragraphs before paywall" field — match the paywall builder field styling */ +#global_marketing_paragraph_count_option .memberful-paywall-builder__field { + margin: 1.5em 0 0 1.8em; +} +#global_marketing_paragraph_count_option .memberful-paywall-builder__field label { + color: #6b7280; + display: block; + font-size: 13px; + font-weight: 500; + margin-bottom: 4px; + text-transform: uppercase; +} + /*--------------------------------------------------------- Restrict Access Metabox ------------------------------------------------------------ */ diff --git a/wordpress/wp-content/plugins/memberful-wp/views/global_marketing.php b/wordpress/wp-content/plugins/memberful-wp/views/global_marketing.php index 03b3d4e2..141959c4 100644 --- a/wordpress/wp-content/plugins/memberful-wp/views/global_marketing.php +++ b/wordpress/wp-content/plugins/memberful-wp/views/global_marketing.php @@ -6,6 +6,7 @@ * * @var bool $use_global_marketing * @var bool $use_global_snippets + * @var int $paragraph_count * @var bool $global_marketing_override * @var string $global_marketing_content * @var array $paywall_config @@ -48,9 +49,16 @@ > - tags in your posts to detect which content to use. If a post contains a Memberful Paywall Divider block, all content above the divider will be shown instead of the excerpt.', 'memberful' ); ?> + tags in your posts to detect which content to use. If a post contains a Memberful Paywall Divider block, all content above the divider will be shown instead of the excerpt.', 'memberful' ); ?> + +