Hi Team,
We are attempting to display an eBook using the Simple Ebook Viewer by Francesco Martini plugin. The viewer works correctly on a blank page; however, when we place the shortcode within a custom tab, the content does not appear.
The shortcode we are using is:
[simebv_viewer book=”MY_EBOOK_SLUG_HERE”]
Could you please advise on what might be preventing it from rendering in the tab? If you need any additional details from our side, we would be happy to provide them.
We look forward to your guidance.
Hi Luis,
Thank you for using our plugin.Please contact the author of Ebook Viewer as ask them how to enable the viewer outside normal page/post content. We simply run do_shortcode, so the issues lies with the shortcode if a specific shortcode is not rendering.
Regards
BrajeshThank you, Brajesh.
Francesco responded the following:
“Hi, probably the issue is that the plugin can handle only one viewer per page, so there is a guard in the function that sets up the resources for the plugin to work:
if (!is_singular()) {
return;
}If the page is not of a single post (https://developer.wordpress.org/reference/functions/is_singular/), the resources are not loaded.
I’m not familiar with the BuddyPress’s custom tabs, so I’m not sure if you can configure them to meet the is_singular() requirement. If you can, that would be the optimal solution.
Otherwise, if you are sure that there will always be only one viewer in that page, an ugly hack would be to remove the guard directly from the source code of the function (the function is conditionally_enqueue_assets in the file includes/simebv-viewer.php). Obviously, any subsequent update of the plugin will overwrite this change.
I’m working in these days at a new version of the plugin, if you confirm that my guess is correct and this is the issue, I’ll try to look at it for a fix, but I can’t make any promises about precise timings.”
Do you have a response that I can send to him?
Hi Danny,
Thank you for sharing their response. As I expected, the issue lies with shortcode. Manually editing shortcode is not advised. Please ask him to provide a filter, I can help you with some code to enable it on BuddyPress profile pages then. If we manually edit their code, It will be lost in next release.Regards
BrajeshHi Brajesh,
Francesco shared the following when asked about a filter:
“If the custom profile tabs you’re using comply with—and don’t interfere with—wp_enqueue_script and wp_enqueue_style (the WordPress functions for adding scripts and styles to a page), I believe I can provide a plugin version that bypasses the singular post limitation by tomorrow (it’s late evening here in Italy). With this version, you’ll be able to use the ebook viewer on custom pages by applying a filter, though the limitation of one viewer instance per page will still remain.”
He will deliver this as a custom build, which means there will be a fee, so we want to be confident it will resolve the issue.
Do you think this approach will solve the problem?
Hi Luis,
Our tabs don’t interfare with wp_enqueue_script or style or the wp_enqueue_scripts hook. The plugin simple adds regular tab to BuddyPress profile.The problem lies with their strategy(there are simple ways like using static flag to prevent duplicate).
Regards
BrajeshThank you for your help Brajesh. With this information, Francesco was able to offer a solution. We appreciate your help.
The topic ‘ [Resolved] Shortcode Not Displaying in Custom Tab’ is closed to new replies.