Will processing shortcodes in posts ever be possible?
Will it ever be possible to use shortcodes in posts without using iframes or other tricks? I mean in a way that causes the shortcode to be processed when the post is loaded, not rendered at some prior time and the post just loads the pre-rendered html. I know 'Theme Compatibility' is currently being worked on and that will be great but having the ability to process shortcodes in posts is far better, in my opinion, since it would keep the other features like comments, likes, searching, etc. This has an impact on how/if we move forward with our project. Shahjahan Jewel, would you mind providing some feedback on if this will ever be possible? Thanks very much!!
An idea....maybe add a way to flag posts that have shortcodes to avoid the do_shortcode call for all posts?
Or maybe add a hook that allows us to modify the message value (not message_rendered) before it is returned to the browser.
I don't think they plan to add the option you mentioned; however, there are paid and free third-party plugins like those from Ross that help customize the community or add new features.
In the case you mentioned, I think this plugin could work for you:
https://youtu.be/4U4PZt4FfWM?si=Y4N8_otkB3xmADv2.
Although it is a paid plugin, I believe it could be useful for you at the moment.
Mike MΒ Thanks for the reply! I've already bought and tried the plugin mentioned in that video. It works but it uses iframes to embed the page with the shortcode inside a FC post. Does it work? Yes, although I did have some issues with the iframe size. But it isn't ideal.
I also tried Ross' plugins and they are great but they don't solve this problem either.
Thanks again.
It should be possible in the future, it already works for course lessons. They could use a similar method for posts I think.
Sam JansenΒ Thanks! Yep, I see that shortcodes work somewhat in course lessons but styles aren't loaded and I don't think javascript is loaded either.
Thomas OatesΒ They need to be injected in the portal head/ portal footer I believe
Chatgpt said this but it is better to wait for native integration ofcourse.
Sam JansenΒ Thanks! Great info.
I did some more digging and this could work if FC would add one line of code to the transformFeed function in FeedHelper.php. I may be making this out to be easier than it is but it seems like this would work.
$feed->message_rendered = apply_filters('fluent_community/feed/modify_feed_return_message', $feed->message_rendered);
Then those that need to modify the post content (message_rendered value) could add a filter that runs do_shortcode (or anything else). Not sure if that one filter could do the style and script things necessary that Sam posted above from ChatGPT but it might work.
Shahjahan JewelΒ , do you think it is possible to get this added? Thanks!!!!!
Thomas OatesΒ The scripts and styles thing I was talking about is a seperate issue I believe but they could add something for that also