1

A client is using WPBakery and a form is being pulled into the description attribute of a shortcode. Ordinarily you would pull the form by its shortcode but the boiler plate demo has the form being pulled with a string beginning with a hashtag.

E-8_JTVCbWM0d3BfZm9ybSUyMGlkJTNEJTIyNDc0JTIyJTVE

[trx_sc_title title_style="accent" title_align="left" link_style="default" title="Stay Tuned for Our Updates" subtitle="newsletter signup" description="#E-8_JTVCbWM0d3BfZm9ybSUyMGlkJTNEJTIyNDc0JTIyJTVE"]

is equivalent to:

[trx_sc_title title_style="accent" title_align="left" link_style="default" title="Stay Tuned for Our Updates" subtitle="newsletter signup" description="[mc4wp_form id="474"]"]

I need to pull a different form from ninjaforms( [ninja_form id=3] ) instead of the mailchimp form in the example. How do I convert the shortcode in the same manner they did?

Thanks in advance for any insight as to what is going on here.

Community
  • 1
  • 1

1 Answers1

0

use two shortcodes. so that it won't be complicated.

function kp_shortcode1($atts, $content = null)
{
    ob_start();
    ?>

    <div class="sc1-section">
       <?php echo do_shortcode($content); ?>
    </div>

    <?php
    $output = ob_get_clean();
    return $output;
}

add_shortcode('kp_shortcode1', 'kp_shortcode1');


function kp_shortcode2($atts, $content = null)
{
    ob_start();
    ?>

    <div class="sc2-section">
      <h1>shortcode 2 content</h1>
    </div>

    <?php
    $output = ob_get_clean();
    return $output;
}

add_shortcode('kp_shortcode2', 'kp_shortcode2');

Inside the wordpress backend use

[kp_shortcode1]

[kp_shortcode2]

[kp_shortcode2]

[kp_shortcode2]

[/kp_shortcode1]

Output would be :

<div class="sc1-section">


  <div class="sc2-section">
      <h1>shortcode 2 content</h1>
  </div>

  <div class="sc2-section">
      <h1>shortcode 2 content</h1>
  </div>

  <div class="sc2-section">
      <h1>shortcode 2 content</h1>
  </div>


</div>
kd patel
  • 607
  • 1
  • 6
  • 15