WordPress Templates

WordPress: Film Festival Site: do_shortcode()

Now let’s turn to the complex footer we have in the screenshot.

This is actually quite easy.

I have installed a highly-regarded FORMS plugin called Ninja Forms. That is why you see a FORMS section in the Dashboard (just below the COMMENTS menu item in the dashboard).

Using a WordPress feature called Shortcodes, we will insert a Ninja Form in our FOOTER.

If you have ever made a WordPress Gallery, you have used Shortcodes. If you look in the TEXT view of a gallery you will see a few words and numbers enclosed in square brackets.

Similarly, if you look in the Ninja Forms ALL FORMS area, you will see the shortcodes listed:

If you put a shortcode into a post or page (text mode only, not visual mode), the functionality triggered by the shortcode will appear there.

However, we can also use a WP function do_shortcode() to add functionality to template files.

Go to the NINJA FORMS area in the site you have setup. Copy the SHORTCODE for the REGISTRATION FORM.

Now open up the footer.php file.

Just beyond after the opening of the FOOTER tag, put in the following:

<?php echo do_shortcode( '[ninja_form id=3]' ); ?>

Test your page. Is that cool? Yah, that’s cool.

NEXT: another template-part