Hooks & Filters
In the previous part, we learned about Shortcodes & Embed Options. Now, we will explore Hooks & Filters.
This document lists the custom WordPress hooks available in the TNC FlipBook - PDF viewer for WordPress plugin along with usage examples.
Filters
tnc_pvfw_facebook_share_thumb_url
Modifies the URL used for social sharing images.
Example:
add_filter( 'tnc_pvfw_facebook_share_thumb_url', function( $url ) { return get_template_directory_uri() . '/images/custom-thumb.png'; });
tnc_pvfw_single_open_file_url
Allows changing the encoded PDF file URL used in single PDF viewer pages.
Example:
add_filter( 'tnc_pvfw_single_open_file_url', function( $encoded_url ) { $url = 'https://example.com/my.pdf'; return base64_encode( $url ); });
Actions
tnc_pvfw_head
Fires in the <head> section of viewer templates.
Example:
add_action( 'tnc_pvfw_head', function() { echo ''; });
tnc_pvfw_footer
Fires before the closing </body> tag of viewer templates.
Example:
add_action( 'tnc_pvfw_footer', function() { echo ''; });
tnc_pvfw_not_allowed_head
Runs in the head section of the “permission denied” layout when a user cannot view a PDF.
Example:
add_action( 'tnc_pvfw_not_allowed_head', function() { echo 'body{background:#fafafa;}'; });
tnc_pvfw_not_allowed_footer
Runs just before the closing body tag of the “permission denied” layout.
Example:
add_action( 'tnc_pvfw_not_allowed_footer', function() { echo ''; });