Title: Impliment plugins directly through code
Last modified: August 31, 2016

---

# Impliment plugins directly through code

 *  Resolved [howiep7](https://wordpress.org/support/users/howiep7/)
 * (@howiep7)
 * [10 years ago](https://wordpress.org/support/topic/impliment-plugins-directly-through-code/)
 * Hi,
 * I installed a plugin which displays recent instagram posts by typing [instagram-
   feed] into a blog post
 * But I want the recent instagram images on specific pages, not blog posts
 * How would I insert this into the html code (I am building a theme from scratch)
 * I tried <?php [instagram-feed] ?> obviously this didn’t work but you get what
   I’m trying to do!
 * Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [yorman](https://wordpress.org/support/users/yorman/)
 * (@yorman)
 * [10 years ago](https://wordpress.org/support/topic/impliment-plugins-directly-through-code/#post-7447127)
 *     ```
       <?php echo do_shortcode('[instagram-feed]'); ?>
       ```
   
 * [https://developer.wordpress.org/reference/functions/do_shortcode/](https://developer.wordpress.org/reference/functions/do_shortcode/)
 *  [Izaac Johansson](https://wordpress.org/support/users/izaacj/)
 * (@izaacj)
 * [10 years ago](https://wordpress.org/support/topic/impliment-plugins-directly-through-code/#post-7447133)
 * You could add `<?php echo do_shortcode('[instagram-feed]'); ?>` in the template
   file. But remember that everyone that uses the theme might not want that functionality
   and/or have that plugin installed.
 * If you’re building this for others to use, I suggest using TGMPA and implementing
   a check to see if the plugin is installed and activated.
 * Here’s the code I use myself to check if a plugin is installed.
 *     ```
       function is_plugin_installed($plugin_dir) {
           if ( ! function_exists( 'get_plugins' ) ) {
               require_once ABSPATH . 'wp-admin/includes/plugin.php';
       			}
           if(!startsWith($plugin_dir, DIRECTORY_SEPARATOR))
           {
               $plugin_dir = DIRECTORY_SEPARATOR . $plugin_dir;
           }
           $plugins = get_plugins($plugin_dir);
           if ($plugins) return true;
               return false;
       }
   
       function startsWith($haystack, $needle) {
           return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
       }
       ```
   
 * To check if it is active you could get the ‘active_plugins’ option array and 
   see if it’s listed.
 * Hope this helps.
 *  Thread Starter [howiep7](https://wordpress.org/support/users/howiep7/)
 * (@howiep7)
 * [10 years ago](https://wordpress.org/support/topic/impliment-plugins-directly-through-code/#post-7447178)
 * Thanks guys, that worked
 * I’m just building the theme for myself at the moment but will bear that in mind
   for the future, thanks Izacc 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Impliment plugins directly through code’ is closed to new replies.

## Tags

 * [plugin-code](https://wordpress.org/support/topic-tag/plugin-code/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 3 participants
 * Last reply from: [howiep7](https://wordpress.org/support/users/howiep7/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/impliment-plugins-directly-through-code/#post-7447178)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
