-
AuthorPosts
-
March 28, 2023 at 12:11 am #12694Alessandro MagnettiParticipant
Hello,
We use shortcoder pro in a multisite where we have defined on the site with the ID 1 some shortcodes containing SQL expressions. Then in function.php we have defined a function to execute that queries from any other site in this way:
add_filter( 'do_shortcode_tag','pre_query_mssql_execute',10,3); function pre_query_mssql_execute($output, $tag, $attr) { if (isset($attr['name'])) phpAlert('Attr name: ' .$attr['name']); if (isset($attr['name']) && strpos($attr['name'], 'query_mssql') !== false) { switch_to_blog(1); $shortcodes = Shortcoder::get_shortcodes(); $shortcode_content = $shortcodes[strtolower($attr['name'])]["content"]; $output = query_mssql_execute($shortcode_content,$attr); restore_current_blog(); } return $output; }
It works but we lose some pretty feature like finding the shortcode around and the integration with WP Bakery page builder from sites with ID != 1.
Have you any plan to implement a feature like “site from where grab the list of shortcode” ?Thank you.
A.
March 28, 2023 at 11:27 pm #12702Aakash ChakravarthyKeymasterHi Alessandro,
Thanks for using Shortcoder PRO.
As of now the plugin does not support multisite and there are no plans either.
Since most users are single site owners, the plugin did not focus multisites.
Also, there are users with thousands of shortcodes. Since the preference is to keep the plugin lightweight, fast and simple features which are very specific/heavy are not implemented.w.r.t your requirement, I can include wordpress hooks wherever needed to introduce customization. You can later use those hooks for multisite features like above. Please do let me know further on this.
Thanks,
AakashNovember 24, 2023 at 4:28 pm #13855lnki5538ParticipantHello Aakash,
I’d like to suggest two specific hooks that could greatly enhance the plugin’s utility in our scenario:
1. A hook immediately after pressing “Locate this shortcode”: By having a hook right after the shortcode is located, it would allow for more dynamic interaction with the shortcode, especially in cases where shortcodes are defined on a different site within the network.
2. A hook when pressing the blue [/] “Insert shortcode to editor” button: This is crucial for our use case. If this hook is available, it would enable us to programmatically execute switch_to_blog(1); and subsequently restore_current_blog();. This functionality would allow us to seamlessly integrate shortcodes from the main site (site with ID 1) into our other sites within the multisite network, without losing the integration with WP Bakery page builder or other features.
Thank you for considering these suggestions.
November 26, 2023 at 12:08 am #13858Aakash ChakravarthyKeymasterHi @lnki5538,
Sorry for the delay. Yes that would be possible. I’ll look through the code and confirm if I can add it in the next version of the plugin.
Thanks,
AakashJuly 25, 2024 at 1:38 am #14888Aakash ChakravarthyKeymasterHi @lnki5538,
I tried to include your suggestions in the latest version. But I was not able to make it as I didn’t get a clear understanding of the requirement. My apologize.
Could you please share more details on #1 and #2 like when you meant “hook” on pressing the button?
Thanks,
AakashOctober 25, 2024 at 10:27 am #15210ankitsharmatvParticipantIs it possible to add Gutenberg Editor along with code /text / Visual editor.
Using this I will be able to add custom patterns anywhere on my website.October 26, 2024 at 1:02 am #15214Aakash ChakravarthyKeymasterHi Ankit,
Shortcoder PRO already has this feature. Can you please check if that helps?
Thanks,
Aakash -
AuthorPosts
- You must be logged in to reply to this topic.