# Get plugin dir in theme's functions.php

**URL:** https://discourse.roots.io/t/get-plugin-dir-in-themes-functions-php/8838
**Category:** bedrock
**Tags:** sage9
**Created:** 2017-02-16T07:12:19Z
**Posts:** 3

## Post 1 by @yyyyaaa — 2017-02-16T07:12:19Z

How do I get the plugins directory path while in my theme’s functions.php?  
Suppose I have Contact form 7 installed and I want to load a file if a functions is undefined. This is what I have tried so far.

```
if ( ! function_exists( 'wpcf7_add_form_tag' ) ) {
    require_once PLUGINDIR . '/contact-form-7/includes/form-tags-manager.php';
}
```

But it always returns path to wp-content, which is not right because all plugins reside in web/app/plugins folder.

---

## Post 2 by @kalenjohnson — 2017-02-16T08:10:53Z

For one, this is a pretty standard WP question, nothing specific to Bedrock or Sage. Second, why would you need to load a function or class from a plugin in your theme? The only reason I could think of is if the plugin is not activated.

---

## Post 3 by @yyyyaaa — 2017-02-16T09:05:57Z

For some reasons, that function I want to use is not available in functions.php, I need that to create a shortcode to use in contact form 7 plugin.
