Add a shortcode to add_shortcode in functions.php

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 side, I used this to implement the shortcode:

[gravityf0rm id="4" title="false" description="false"]

Hope this saves you a bit of time.

Isaac Adams-Hands

Full Stack Developer, Digital Marketer, and InfoSec enthusiast. He received his Bachelor’s Degree from the University of Western Sydney and his Business Diploma from Georgian College before joining various marketing positions in search portals, e-commerce, higher education, and addiction recovery services.

Follow @ twitter

Related posts

Stylize Font Awesome

Here is a little guide on how to Rotate, Flip, Resize, Compress, Color, Lighten & Bold Font Awesome:

Full size thumbnail image w/ alt tag title

Here is a quick example of how to add a large thumbnail image with the title as the Alt Tag attribute Alt Tag attribute <?php the_post_thumbnail( ‘large’, array( ‘title’ => get_the_title() ) ); ?> You can replace ‘large’ with thumbnail, medium, medium_large, & full.