Shortcodes and Blocks Reference

Server-rendered output reference and the programmatic API.

Shortcodes

[tnc-flipbook-3d-embed       id="" width="100%" height="600px" page="1"
                              language="" transparent="" title="" class=""
                              fullscreen_link="" fullscreen_link_text=""
                              fullscreen_link_position="above" fullscreen_link_align="left"
                              fullscreen_link_mode="popup"
                              fullscreen_popup_width="90vw" fullscreen_popup_height="90vh"
                              fullscreen_popup_theme="dark" fullscreen_transparent=""
                              fullscreen_nofollow=""]

[tnc-flipbook-3d-link        id="" text="View TNC FlipBook 3D" mode="popup"
                              style="text" popup_width="90vw" popup_height="90vh"
                              popup_theme="dark" page="" transparent=""
                              nofollow="" class=""]

[tnc-flipbook-3d-image-link  id="" cover="true" image="" alt="" width=""
                              mode="popup" popup_width="90vw" popup_height="90vh"
                              popup_theme="dark" page="" transparent=""
                              nofollow="" class=""]

mode accepts popup, new_tab, or same_tab. style accepts text or button. cover="true" auto-resolves the image from the FlipBook's Featured Image or first image source.

Removed parameters (no longer accepted): autoplay, theme, effect, sound. Configure these per-FlipBook in the admin instead.

Programmatic render

TNC_Flipbook_3D_Frontend::render_shortcode( $atts );
TNC_Flipbook_3D_Frontend::render_link_shortcode( $atts );
TNC_Flipbook_3D_Frontend::render_image_link_shortcode( $atts );
TNC_Flipbook_3D_Frontend::render( $post_id, $overrides = [] );
TNC_Flipbook_3D_Frontend::get_cover_url( $post_id );

Or the helper function:

echo tnc_flipbook_3d_get_cover_url( $post_id, 'large' );

Output filters

Shortcodes/blocks emit through these filters before output:

  • tncfb3d_shortcode_output — inline embed shortcode
  • tncfb3d_iframe_attributes — iframe attribute array
  • tncfb3d_viewer_url — iframe src
  • tncfb3d_viewer_access — return false to deny rendering
  • tncfb3d_embed_block_output, tncfb3d_link_block_output, tncfb3d_image_link_block_output

Gutenberg blocks

Block

Block name

Server-rendered

TNC FlipBook 3D Embed

tncfb3d/flipbook-embed

iframe

TNC FlipBook 3D Link

tncfb3d/flipbook-link

button or link

TNC FlipBook 3D Image Link

tncfb3d/flipbook-image-link

image link

All blocks save: null and render via render_callback in class-tnc-flipbook-3d-blocks.php. Built without JSX (wp.element.createElement) so no npm/webpack pipeline is needed.

Iframe isolation

The viewer always renders inside an iframe pointing to ?tncfb_viewer={id} (intercepted on template_redirect). This gives complete CSS/JS isolation from the WordPress theme. The iframe's content is generated via TNC_Flipbook_3D_Frontend::serve_viewer() and then exits.

Permalink endpoint

/flipbook/{slug}/ URLs use templates/single-flipbook.php to render the same standalone viewer. After changing CPT registration (slug, publicly_queryable, etc.), flush rewrite rules — happens automatically on plugin activation, manual via Settings → Permalinks → Save.

Attribute defaults

Shortcode attribute defaults are set in render_shortcode() via shortcode_atts(). Override the defaults in your theme:

add_filter( 'shortcode_atts_tnc-flipbook-3d-embed', function( $out, $pairs, $atts ) {
    $out['height'] = $out['height'] ?: '800px';
    return $out;
}, 10, 3 );

Content access at the runtime layer

Use tncfb3d_content_access to gate page-level access (e.g. preview-only with a paywall):

add_filter( 'tncfb3d_content_access', function( $gating, $post_id ) {
    if ( ! my_user_has_paid( $post_id ) ) {
        $gating['preview_pages'] = 5;
        $gating['gating_message'] = 'Upgrade to read the full document.';
    }
    return $gating;
}, 10, 2 );

The viewer reads this via the gating overlay (.tncfb-gating-overlay).

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us