a few issues – thumbnail and json string output
-
The thumbnail I am including via link (to a media gallery image) is not showing on the page, instead I get the generic one
data:image/svg+xml,%3Csvg%20id%3D%22Layer_1%22%20data-name%3D%22Layer%201%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20210%20297%22%3E%3Crect%20width%3D%22210%22%20height%3D%22297%22%20style%3D%22fill%3A%23f1f2f2%22/%3E%3Ccircle%20cx%3D%22143%22%20cy%3D%2295%22%20r%3D%2212%22%20style%3D%22fill%3A%23e3e8ed%22/%3E%3Cpolygon%20points%3D%22131%20138%20120%20149%2095%20124%2034%20184%20176%20185%20131%20138%22%20style%3D%22fill%3A%23e3e8ed%22/%3E%3C/svg%3E
Also, on the page when the pdf loads I am getting a json string outside of the flipbook – it did not load properly after this
I added a quick script to wrap the json in script tags in the content filter and that fixed the pdf loading issue, but i am still getting no thumbnails
add_filter('the_content', function($content) {
if (strpos($content, 'window.option_df_') === false) { return $content; }
// Step 1: Decode HTML entities so we can work with real characters
$decoded = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
// Step 2: Match DearFlip JS blocks
preg_match_all( '/window\.option_df_[0-9]+\s*=.*?parseBooks\(\);\s*\}/s', $decoded, $matches );
if (!empty($matches[0])) {
foreach ($matches[0] as $js_block) {
// Step 3: Normalize curly quotes → straight quotes
$normalized = str_replace(
['“','”','′','″','’','‘'],
['"','"',"'",'"',"'", "'"],
$js_block
);
// Step 4: Wrap the cleaned JS in a script tag
$wrapped = '<script class="dearflip-init">' . $normalized . '</script>';
// Step 5: Replace the original JS block with the wrapped version
$decoded = str_replace($js_block, $wrapped, $decoded);
}
}
return $decoded;
});as an FYI, if needed, the shortcode is being used inside a custom block that runs wp_kses, i initially tried to allow “script” through the kses bypass, that did not work though.
and I am using the thumb type: [dflip id=”1″ type=”thumb”][/dflip]We have a paid version of dflip from codecanyon, and plan on paying for the full version here if we get it working
You must be logged in to reply to this topic.