Title: Include the plugins path
Last modified: August 21, 2016

---

# Include the plugins path

 *  Resolved [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/include-the-plugins-path/)
 * hi there,
 * Yep can agree this plugin crashes the theme.
 * Pasting this in your themes functions.php doesn;t cut the mustard.
 *     ```
       function my_register_fields()
       {
           include_once('advanced-custom-fields-nav-menu-field/nav-menu-v4.php');
       }
       add_action('acf/register_fields', 'my_register_fields');
       ```
   
 * Instead you NEED TO INCLUDE the directory of you plugins…
    This will resolve 
   it.
 *     ```
       function my_register_fields()
       {
           include_once(WP_PLUGIN_DIR . '/advanced-custom-fields-nav-menu-field/nav-menu-v4.php');
       }
       add_action('acf/register_fields', 'my_register_fields');
       ```
   
 * [https://wordpress.org/plugins/advanced-custom-fields-nav-menu-field/](https://wordpress.org/plugins/advanced-custom-fields-nav-menu-field/)

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

 *  Thread Starter [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907165)
 * At first I thought this was a standalone plugin but its not. It needs the advanced
   post types plugin to be available first. This is just a handy extension, but 
   the description on the install page doesn’t say this.
 * I gather that this was supposed to be added to the functions file in the advanced
   fields plugins (not this one)… so by doing it this way you can now add this code
   to your function.php inside your theme and be able to upgrade either plugins 
   when you need to without having to re-paste this in.
 * Thanks
 * Andi
 *  Thread Starter [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907168)
 * … Actually now i got it working I cannot see the location how to add a custom
   field to a menu… I want to make a selection and data in a menu to be <a href=””
   data-filter=””… or <a href=”” data-expand=””
 * By using custom fields applied to my menu’s I was hoping to achieve that but 
   all I can see is how they interact with pages and posts.
 *  Thread Starter [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907170)
 * sorry I found it. But I also wanted to have a drop down attached to the menu 
   in the admin section to chose
 * data-filter
    data-expand
 * Then the value of that item
 * x
 * so in the nav you get:
 *     ```
       <li class="page_item selected" ><a href="/" data-filter="*" ><span>wpb</span></a></li>
                   <li class="page_item" ><a href="/#case-study" data-filter=".case-study" ><span>our work</span></a></li>
                   <li class="page_item" ><a href="/#about-wpb" data-expand=".about-wpb" ><span>about us</span></a></li>
       ```
   
 * Is this possible?
 * thanks
 * Andi
 *  Plugin Author [Faison](https://wordpress.org/support/users/faison/)
 * (@faison)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907559)
 * Hi Andi Lee Davis,
 * Sorry for the late response. The installation instructions were pulled in directly
   from the plugin template that the developer of ACF provides, and since this was
   my first plugin, I didn’t know if that should still be valid.
 * I’ve just updated the plugin (currently just on github) and the installation 
   instructions will be much more clear. Basically make sure you have ACF installed,
   then install this plugin through the plugin installer.
 * So sorry for that confusion.
 * Regarding your question about adding data-filter and data-expand: Assuming you
   haven’t figured out a way to do that in one way or another, the best way to manage
   that would be through a filter. I don’t have the time to go into too much detail,
   but it looks like the filter you would need is “nav_menu_link_attributes”. If
   you google that, look it up in the codex, or even in WordPress core, that could
   get you started.
 * Thanks,
    Faison
 *  Thread Starter [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * (@andi-lee-davis)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907560)
 * Hi there, Yeah I solved it by using the xfn field already in the wrodpress section.
   Thanks for your information and well done on your plugin.
 * Its a long time back but using this variable WP_PLUGIN_DIR resolves that initial
   issue.
 * Thanks
 * Andi

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

The topic ‘Include the plugins path’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-custom-fields-nav-menu-field_fdfdfd.
   svg)
 * [Advanced Custom Fields: Nav Menu Field](https://wordpress.org/plugins/advanced-custom-fields-nav-menu-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-nav-menu-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-nav-menu-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-nav-menu-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-nav-menu-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-nav-menu-field/reviews/)

## Tags

 * [plugins directory](https://wordpress.org/support/topic-tag/plugins-directory/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 5 replies
 * 2 participants
 * Last reply from: [Andi Lee Davis](https://wordpress.org/support/users/andi-lee-davis/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/include-the-plugins-path/#post-4907560)
 * Status: resolved