How to call a plugin function in footer.php

After installing the plugin and adding images to a new gallery, paste this code into your footer.php file where you want the gallery to display

<?php echo do_shortcode('[easy-media med="231,233"]'); ?>

Simply change the gallery i.d’s to your own as the ones in the code above are examples.

No Need To Use A Plugin

I also suggest you use the native WordPress gallery which enables you to set both the size of the thumbnail images (Settings > Media) and the amount of columns.

You can also hook these in from your child themes functions.php file rather then add the shortcode to the footer.php template which isn’t best practice.

Sample code (Tested)

function wpsites_footer_gallery() {

echo '<div class="footer-gallery">';
echo do_shortcode('');
echo '</div>';
}

add_action('wp_footer', 'wpsites_footer_gallery');

Position using the .footer-gallery class.

Change the wp_footer hook to your theme specific hook (If it includes hooks)

Here’s the result using the code above:

enter image description here

Leave a Comment