Add a shortcode to add_shortcode in functions.php

by

This drove me a little crazy one afternoon. I had to add a gravity forms shortcode to a new add_shortcode script in functions.php

To accomplish this, I added this to my code:

' . do_shortcode($content) . '

Here is how it looks in its working example. I work best by watching. Too many people just give the answer without providing the question:

function full_cta_link( $atts, $content = null ) {
return '<div class="row"><div class="col-lg-3"><h2>Title</h2><p>Content.</p></div>
<div class="col-lg-3">' . do_shortcode($content) . '</div></div>';
}
add_shortcode('full_cta_call', 'full_cta_link');

On the WordPress.org side, I used this to implement the shortcode:

[full_cta_call] [gravityform id="4" title="false" description="false"] [/full_cta_call]

Hope this saves you a bit of time.

Leave a Reply

Your email address will not be published. Required fields are marked *


PageLines