Title: Load plugin in my theme
Last modified: August 22, 2016

---

# Load plugin in my theme

 *  Resolved [CesarDenis](https://wordpress.org/support/users/cesardenis/)
 * (@cesardenis)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/)
 * When I add the plugin on my theme to “acf / include_fields” the css references
   and script does not load.
 * [https://wordpress.org/plugins/advanced-custom-fields-font-awesome/](https://wordpress.org/plugins/advanced-custom-fields-font-awesome/)

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

 *  Plugin Author [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * (@mattkeys)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935647)
 * I am not sure I am following what you are doing. Can you post some example code(
   use a service like pastebin or something).
 * Thanks,
 * Matt
 *  Thread Starter [CesarDenis](https://wordpress.org/support/users/cesardenis/)
 * (@cesardenis)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935649)
 * I have included in the function.php the following code:
 *     ```
       function register_fields() {
               include_once( get_stylesheet_directory() . '/inc/add-ons/font-awesome/acf-font-awesome-v5.php');
       }
       add_action('acf/include_fields', 'register_fields');
       ```
   
 * to include your plugin.
 * When I select an icon in my field, I found that was not load the icons, was appearing
   square in place.
 * So I checked the page code and saw the following line:
 * `<link rel='stylesheet' id='acf-input-font-awesome-input-css' href='http://developer.
   adesign.com.br/orangeone/wordpress/wp-content/plugins/Applications/MAMP/htdocs/
   orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome/css/
   input.css?ver=1.5' type='text/css' media='all' />`
 * I hope it helps 🙂
    Cesar
 *  Plugin Author [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * (@mattkeys)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935661)
 * Which version of ACF are you using?
 *  Thread Starter [CesarDenis](https://wordpress.org/support/users/cesardenis/)
 * (@cesardenis)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935662)
 * ACF PRO 5.2.1
 *  Plugin Author [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * (@mattkeys)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935680)
 * Interesting problem, it looks like it comes down the the plugin_dir_url() function
   used to find the path to the CSS/JS assets. Notice how the asset URL includes
   the PHP path.
 * I see some conversation about it on stack exchange here: [http://wordpress.stackexchange.com/questions/41868/plugin-dir-url-adds-path-to-url](http://wordpress.stackexchange.com/questions/41868/plugin-dir-url-adds-path-to-url)
 * Presumably this problem is effecting all 5.x add-ons that include their own CSS/
   JS, because this function comes right out of the ACF add on template I used to
   create this plugin: [https://github.com/elliotcondon/acf-field-type-template/blob/master/acf-FIELD_NAME-v5.php](https://github.com/elliotcondon/acf-field-type-template/blob/master/acf-FIELD_NAME-v5.php)
 * I am not sure what the fix is yet, but I will take a peak at the v4 methods of
   finding this asset path because they appear different than v5.
 *  Plugin Author [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * (@mattkeys)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935689)
 * Here is an experimental version of the v5 file which uses the old ACF 4.x method
   of finding asset paths:
 * [http://pastebin.com/9kaBHEGi](http://pastebin.com/9kaBHEGi)
 * Let me know how it works for you, seems to fix the problem locally for me.
 *  Thread Starter [CesarDenis](https://wordpress.org/support/users/cesardenis/)
 * (@cesardenis)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935697)
 * It worked 🙂 see the log:
 *     ```
       Array
       (
           [path] => /Applications/MAMP/htdocs/orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome
           [dir] => http://developer.adesign.com.br/orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome/
           [version] => 1.5
       )
       ```
   
 * Thanks,
    Cesar
 *  Plugin Author [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * (@mattkeys)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935723)
 * Cool thanks for testing.
 * I will test this a bit more and roll it into an update. I will report the issue
   to ACF too so Elliot is aware that this problem is out there.

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

The topic ‘Load plugin in my theme’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-font-awesome/assets/icon-256x256.
   jpg?rev=3435775)
 * [Advanced Custom Fields: Font Awesome Field](https://wordpress.org/plugins/advanced-custom-fields-font-awesome/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-font-awesome/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-font-awesome/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-font-awesome/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-font-awesome/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Matt Keys](https://wordpress.org/support/users/mattkeys/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/load-plugin-in-my-theme/#post-5935723)
 * Status: resolved