Shortcodes not enabled on archives/search/categories
-
I’m using the Smart Slider plugin as a gutenberg block, which uses a shortcode to insert a slider pane. It works just fine on the home page using Tove, but when I use search or an archive or category page (see the link above), the page does not render the slider and instead displays the raw shortcode. I’ve asked the plugin developer, and he says this is a theme issue: (copied from the reply and the plugin’s help documentation)
It it up to your theme, where it processes shortcodes and where it doesn’t. As you see here:
https://smartslider.helpscoutdocs.com/article/1945-shortcode-displays-instead-of-the-slider#theme-issue
you can call in the content of a page, without running its shortcodes. So I suggest getting in touch with your theme’s developers about this issue, as it has to be fixed within their code.Theme issue It's also possible that your theme doesn't use WordPress' the_post() function to output the post/page content. This issue exists with for example, Illdy theme which outputs the content this way: <?php echo $static_page_content; ?> The solution to this problem is to run the do_shortcode() function on this $static_page_content variable: <?php echo do_shortcode($static_page_content;) ?> If your theme uses the the_content() function and the shortcode still not working, add the following filter to your theme's functions.php file: add_filter( 'the_content', 'do_shortcode' );
I tried adding the final line of code (hoping that Tove uses the the_content() function, but it didn’t make a difference.
Any suggestions on how to fix this issue using Tove? I’d also be fine with just hiding the block altogether on the archives/search/categories pages, but I’m not sure that’s possible either, since I don’t think Tove supports customizing those pages.
Any help would be very appreciated!
The page I need help with: [log in to see the link]
- The topic ‘Shortcodes not enabled on archives/search/categories’ is closed to new replies.