Process shortcodes in bits
-
Is it possible to have the plugin process shortcodes in HTML content?
For example, if a bit (of HTML) includes [contact-form-7 id=”25″ title=”Inline”], it would be nice if it detected and processed the contact form in its place (ie: <?php echo do_shortcode(‘[contact-form-7 id=”25″ title=”Inline”]’); ?> )
I include a patch should you choose to accept it. Doing so opens the possibility of including other components, widgets, etc. within bits.
# diff -urN snippy.bak snippy.php --- snippy.bak 2017-10-02 11:45:33.508487494 -0400 +++ snippy.php 2017-10-02 11:49:13.492500570 -0400 @@ -282,7 +282,7 @@ else if ($bit_type === 'html') { // replace placeholders in html value - $html = html_entity_decode($bit_value); + $html = do_shortcode(html_entity_decode($bit_value)); $placeholders_merged = Utils::merge_placeholders_and_atts($bit, $atts); // if has content add content to placeholder @@ -334,4 +334,4 @@ } // go!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Process shortcodes in bits’ is closed to new replies.