Skip to content

Commit

Permalink
Add convertkit_output_restrict_content_content_preview and `convert…
Browse files Browse the repository at this point in the history
…kit_output_restrict_content_call_to_action` filters
  • Loading branch information
n7studios committed Dec 22, 2023
1 parent e10bba7 commit 48918ce
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion includes/class-convertkit-output-restrict-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,36 @@ private function restrict_content( $content ) {
return $content;
}

return $this->get_content_preview( $content ) . $this->get_call_to_action( $this->post_id );
// Fetch the content preview.
$content_preview = $this->get_content_preview( $content );

/**
* Define the output for the content preview when the visitor is not
* an authenticated subscriber.
*
* @since 2.4.1
*
* @param string $content_preview Content preview.
* @param int $post_id Post ID.
*/
$content_preview = apply_filters( 'convertkit_output_restrict_content_content_preview', $content_preview, $this->post_id );

// Fetch the call to action.
$call_to_action = $this->get_call_to_action( $this->post_id );

/**
* Define the output for the call to action, displayed below the content preview,
* when the visitor is not an authenticated subscriber.
*
* @since 2.4.1
*
* @param string $call_to_action Call to Action.
* @param int $post_id Post ID.
*/
$call_to_action = apply_filters( 'convertkit_output_restrict_content_call_to_action', $call_to_action, $this->post_id );

// Return the content preview and its call to action.
return $content_preview . $call_to_action;

}

Expand Down

0 comments on commit 48918ce

Please sign in to comment.